Skip to main content

Crate use_js_keyword

Crate use_js_keyword 

Source
Expand description

§use-js-keyword

JavaScript keyword and reserved-word primitives for RustUse.

§Experimental

use-js-keyword is experimental while use-js remains below 0.3.0.

§Example

use use_js_keyword::{JsKeyword, is_js_keyword, is_js_reserved_word};

let keyword: JsKeyword = "await".parse()?;

assert_eq!(keyword.as_str(), "await");
assert!(is_js_keyword("class"));
assert!(is_js_reserved_word("interface"));

§Scope

  • Common JavaScript keywords.
  • Common future and strict-mode reserved words.
  • Lightweight vocabulary checks for metadata and validation helpers.

§Non-goals

  • Context-sensitive parser behavior.
  • Version-specific reserved-word tables.
  • Full ECMAScript lexical analysis.

§License

Licensed under either Apache-2.0 or MIT.

Enums§

JsKeyword
Common JavaScript keywords.
JsKeywordParseError
Error returned when parsing JavaScript vocabulary fails.
JsReservedWord
JavaScript reserved words, including keywords and common future reserved words.

Functions§

is_js_keyword
Returns whether input is one of the common JavaScript keywords.
is_js_reserved_word
Returns whether input is a keyword or common reserved word.