Browse Source

Added documentation to Keyword

pull/293/head
HalidOdat 5 years ago
parent
commit
125c75aa74
  1. 61
      boa/src/syntax/ast/keyword.rs
  2. 2
      boa/src/syntax/ast/node.rs

61
boa/src/syntax/ast/keyword.rs

@ -33,33 +33,38 @@ pub enum Keyword {
/// The `break` keyword. /// The `break` keyword.
/// ///
/// More information: /// More information:
/// - [break `Node` documentation][node]
/// - [ECMAScript reference](https://tc39.es/ecma262/#prod-BreakStatement) /// - [ECMAScript reference](https://tc39.es/ecma262/#prod-BreakStatement)
/// - [MDN documentation][mdn] /// - [MDN documentation][mdn]
/// ///
/// [node]: ../node/enum.Node.html#variant.Break
/// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/break /// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/break
Break, Break,
/// The `case` keyword. /// The `case` keyword.
/// ///
/// More information: /// More information:
/// - [switch `Node` documentation][node]
/// - [ECMAScript reference](https://tc39.es/ecma262/#prod-CaseClause) /// - [ECMAScript reference](https://tc39.es/ecma262/#prod-CaseClause)
/// - [MDN documentation][mdn] /// - [MDN documentation][mdn]
/// ///
/// [node]: ../node/enum.Node.html#variant.Switch
/// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/switch /// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/switch
Case, Case,
/// The `catch` keyword. /// The `catch` keyword.
/// ///
/// More information: /// More information:
/// - [try `Node` documentation][node]
/// - [ECMAScript reference](https://tc39.es/ecma262/#prod-Catch) /// - [ECMAScript reference](https://tc39.es/ecma262/#prod-Catch)
/// - [MDN documentation][mdn] /// - [MDN documentation][mdn]
/// ///
/// [node]: ../node/enum.Node.html#variant.Try
/// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/try...catch /// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/try...catch
Catch, Catch,
/// The `class` keyword. /// The `class` keyword.
/// ///
///
/// More information: /// More information:
/// - [ECMAScript reference](https://tc39.es/ecma262/#prod-ClassDeclaration) /// - [ECMAScript reference](https://tc39.es/ecma262/#prod-ClassDeclaration)
/// - [MDN documentation][mdn] /// - [MDN documentation][mdn]
@ -67,21 +72,25 @@ pub enum Keyword {
/// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/class /// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/class
Class, Class,
/// The continue keyword. /// The `continue` keyword.
/// ///
/// More information: /// More information:
/// - [continue `Node` documentation][node]
/// - [ECMAScript reference](https://tc39.es/ecma262/#prod-ContinueStatement) /// - [ECMAScript reference](https://tc39.es/ecma262/#prod-ContinueStatement)
/// - [MDN documentation][mdn] /// - [MDN documentation][mdn]
/// ///
/// [node]: ../node/enum.Node.html#variant.Continue
/// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/continue /// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/continue
Continue, Continue,
/// The `const` keyword. /// The `const` keyword.
/// ///
/// More information: /// More information:
/// - [const `Node` documentation][node]
/// - [ECMAScript reference](https://tc39.es/ecma262/#sec-let-and-const-declarations) /// - [ECMAScript reference](https://tc39.es/ecma262/#sec-let-and-const-declarations)
/// - [MDN documentation][mdn] /// - [MDN documentation][mdn]
/// ///
/// [node]: ../node/enum.Node.html#variant.ConstDecl
/// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/const /// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/const
Const, Const,
@ -97,19 +106,23 @@ pub enum Keyword {
/// The `default` keyword. /// The `default` keyword.
/// ///
/// More information: /// More information:
/// - [switch `Node` documentation][node]
/// - [ECMAScript reference default clause](https://tc39.es/ecma262/#prod-DefaultClause) /// - [ECMAScript reference default clause](https://tc39.es/ecma262/#prod-DefaultClause)
/// - [ECMAScript reference default export](https://tc39.es/ecma262/#prod-ImportedDefaultBinding) /// - [ECMAScript reference default export](https://tc39.es/ecma262/#prod-ImportedDefaultBinding)
/// - [MDN documentation][mdn] /// - [MDN documentation][mdn]
/// ///
/// [node]: ../node/enum.Node.html#variant.Switch
/// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/default /// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/default
Default, Default,
/// The `delete` keyword. /// The `delete` keyword.
/// ///
/// More information: /// More information:
/// - [delete `UnaryOp` documentation][unary]
/// - [ECMAScript reference](https://tc39.es/ecma262/#sec-delete-operator) /// - [ECMAScript reference](https://tc39.es/ecma262/#sec-delete-operator)
/// - [MDN documentation][mdn] /// - [MDN documentation][mdn]
/// ///
/// [unary]: ../op/enum.UnaryOp.html#variant.Delete
/// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/delete /// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/delete
Delete, Delete,
@ -122,12 +135,20 @@ pub enum Keyword {
/// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/do...while /// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/do...while
Do, Do,
/// The `else` keyword.
///
/// More information:
/// - [if `Node` documentation][node]
/// - [ECMAScript reference](https://tc39.es/ecma262/#prod-IfStatement)
/// - [MDN documentation][mdn]
/// ///
/// [node]: ../node/enum.Node.html#variant.If
/// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/if...else
Else, Else,
/// The `enum` keyword /// The `enum` keyword.
/// ///
/// Future reserved keywords. /// Future reserved keyword.
Enum, Enum,
/// The `export` keyword. /// The `export` keyword.
@ -151,36 +172,44 @@ pub enum Keyword {
/// The `finally` keyword. /// The `finally` keyword.
/// ///
/// More information: /// More information:
/// - [try `Node` documentation][node]
/// - [ECMAScript reference](https://tc39.es/ecma262/#prod-Finally) /// - [ECMAScript reference](https://tc39.es/ecma262/#prod-Finally)
/// - [MDN documentation][mdn] /// - [MDN documentation][mdn]
/// ///
/// [node]: ../node/enum.Node.html#variant.Try
/// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/try...catch /// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/try...catch
Finally, Finally,
/// The `for` keyword. /// The `for` keyword.
/// ///
/// More information: /// More information:
/// - [for loop `Node` documentation][node]
/// - [ECMAScript reference](https://tc39.es/ecma262/#prod-ForDeclaration) /// - [ECMAScript reference](https://tc39.es/ecma262/#prod-ForDeclaration)
/// - [MDN documentation][mdn] /// - [MDN documentation][mdn]
/// ///
/// [node]: ../node/enum.Node.html#variant.ForLoop
/// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for /// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for
For, For,
/// The `function` keyword. /// The `function` keyword.
/// ///
/// More information: /// More information:
/// - [function `Node` documentation][node]
/// - [ECMAScript reference](https://tc39.es/ecma262/#sec-terms-and-definitions-function) /// - [ECMAScript reference](https://tc39.es/ecma262/#sec-terms-and-definitions-function)
/// - [MDN documentation][mdn] /// - [MDN documentation][mdn]
/// ///
/// [node]: ../node/enum.Node.html#variant.FunctionDecl
/// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function /// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function
Function, Function,
/// The `if` keyword. /// The `if` keyword.
/// ///
/// More information: /// More information:
/// - [if `Node` documentation][node]
/// - [ECMAScript reference](https://tc39.es/ecma262/#prod-IfStatement) /// - [ECMAScript reference](https://tc39.es/ecma262/#prod-IfStatement)
/// - [MDN documentation][mdn] /// - [MDN documentation][mdn]
/// ///
/// [node]: ../node/enum.Node.html#variant.If
/// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/if...else /// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/if...else
If, If,
@ -202,7 +231,7 @@ pub enum Keyword {
/// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/instanceof /// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/instanceof
InstanceOf, InstanceOf,
/// The`import` keyword. /// The `import` keyword.
/// ///
/// More information: /// More information:
/// - [ECMAScript reference](https://tc39.es/ecma262/#sec-imports) /// - [ECMAScript reference](https://tc39.es/ecma262/#sec-imports)
@ -214,27 +243,33 @@ pub enum Keyword {
/// The `let` keyword. /// The `let` keyword.
/// ///
/// More information: /// More information:
/// - [let `Node` documentation][node]
/// - [ECMAScript reference](https://tc39.es/ecma262/#sec-let-and-const-declarations) /// - [ECMAScript reference](https://tc39.es/ecma262/#sec-let-and-const-declarations)
/// - [MDN documentation][mdn] /// - [MDN documentation][mdn]
/// ///
/// [node]: ../node/enum.Node.html#variant.LetDecl
/// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/let /// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/let
Let, Let,
/// The `new` keyword. /// The `new` keyword.
/// ///
/// More information: /// More information:
/// - [new `Node` documentation][node]
/// - [ECMAScript reference](https://tc39.es/ecma262/#prod-NewExpression) /// - [ECMAScript reference](https://tc39.es/ecma262/#prod-NewExpression)
/// - [MDN documentation][mdn] /// - [MDN documentation][mdn]
/// ///
/// [node]: ../node/enum.Node.html#variant.New
/// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/new /// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/new
New, New,
/// The `return` keyword /// The `return` keyword
/// ///
/// More information: /// More information:
/// - [return `Node` documentation][node]
/// - [ECMAScript reference](https://tc39.es/ecma262/#prod-ReturnStatement) /// - [ECMAScript reference](https://tc39.es/ecma262/#prod-ReturnStatement)
/// - [MDN documentation][mdn] /// - [MDN documentation][mdn]
/// ///
/// [node]: ../node/enum.Node.html#variant.Return
/// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/return /// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/return
Return, Return,
@ -250,72 +285,88 @@ pub enum Keyword {
/// The `switch` keyword. /// The `switch` keyword.
/// ///
/// More information: /// More information:
/// - [switch `Node` documentation][node]
/// - [ECMAScript reference](https://tc39.es/ecma262/#prod-SwitchStatement) /// - [ECMAScript reference](https://tc39.es/ecma262/#prod-SwitchStatement)
/// - [MDN documentation][mdn] /// - [MDN documentation][mdn]
/// ///
/// [node]: ../node/enum.Node.html#variant.Switch
/// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/switch /// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/switch
Switch, Switch,
/// The `this` keyword. /// The `this` keyword.
/// ///
/// More information: /// More information:
/// - [this `Node` documentation][node]
/// - [ECMAScript reference](https://tc39.es/ecma262/#sec-this-keyword) /// - [ECMAScript reference](https://tc39.es/ecma262/#sec-this-keyword)
/// - [MDN documentation][mdn] /// - [MDN documentation][mdn]
/// ///
/// [node]: ../node/enum.Node.html#variant.This
/// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/this /// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/this
This, This,
/// The `throw` keyword. /// The `throw` keyword.
/// ///
/// More information: /// More information:
/// - [throw `Node` documentation][node]
/// - [ECMAScript reference](https://tc39.es/ecma262/#prod-ArrowFunction) /// - [ECMAScript reference](https://tc39.es/ecma262/#prod-ArrowFunction)
/// - [MDN documentation][mdn] /// - [MDN documentation][mdn]
/// ///
/// [node]: ../node/enum.Node.html#variant.Throw
/// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions /// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions
Throw, Throw,
/// The `try` keyword. /// The `try` keyword.
/// ///
/// More information: /// More information:
/// - [try `Node` documentation][node]
/// - [ECMAScript reference](https://tc39.es/ecma262/#prod-TryStatement) /// - [ECMAScript reference](https://tc39.es/ecma262/#prod-TryStatement)
/// - [MDN documentation][mdn] /// - [MDN documentation][mdn]
/// ///
/// [node]: ../node/enum.Node.html#variant.Try
/// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/try...catch /// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/try...catch
Try, Try,
/// The `typeof` keyword. /// The `typeof` keyword.
/// ///
/// More information: /// More information:
/// - [typeof `UnaryOp` documentation][unary]
/// - [ECMAScript reference](https://tc39.es/ecma262/#sec-typeof-operator) /// - [ECMAScript reference](https://tc39.es/ecma262/#sec-typeof-operator)
/// - [MDN documentation][mdn] /// - [MDN documentation][mdn]
/// ///
/// [unary]: ../op/enum.UnaryOp.html#variant.TypeOf
/// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/typeof /// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/typeof
TypeOf, TypeOf,
/// The `var` keyword. /// The `var` keyword.
/// ///
/// More information: /// More information:
/// - [var `Node` documentation][node]
/// - [ECMAScript reference](https://tc39.es/ecma262/#prod-VariableStatement) /// - [ECMAScript reference](https://tc39.es/ecma262/#prod-VariableStatement)
/// - [MDN documentation][mdn] /// - [MDN documentation][mdn]
/// ///
/// [node]: ../node/enum.Node.html#variant.VarDecl
/// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/var /// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/var
Var, Var,
/// The `void` keyword. /// The `void` keyword.
/// ///
/// More information: /// More information:
/// - [void `UnaryOp` documentation][unary]
/// - [ECMAScript reference](https://tc39.es/ecma262/#sec-void-operator) /// - [ECMAScript reference](https://tc39.es/ecma262/#sec-void-operator)
/// - [MDN documentation][mdn] /// - [MDN documentation][mdn]
/// ///
/// [unary]: ../op/enum.UnaryOp.html#variant.Void
/// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/void /// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/void
Void, Void,
/// The `while` keyword. /// The `while` keyword.
/// ///
/// More information: /// More information:
/// - [while `Node` documentation][node]
/// - [ECMAScript reference](https://tc39.es/ecma262/#prod-grammar-notation-WhileStatement) /// - [ECMAScript reference](https://tc39.es/ecma262/#prod-grammar-notation-WhileStatement)
/// - [MDN documentation][mdn] /// - [MDN documentation][mdn]
/// ///
/// [node]: ../node/enum.Node.html#variant.While
/// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/while /// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/while
While, While,

2
boa/src/syntax/ast/node.rs

@ -1,3 +1,5 @@
//! This module implements the `Node` structure, which composes the AST.
use crate::syntax::ast::{ use crate::syntax::ast::{
constant::Const, constant::Const,
op::{BinOp, Operator, UnaryOp}, op::{BinOp, Operator, UnaryOp},

Loading…
Cancel
Save