mirror of
https://github.com/jashkenas/coffeescript.git
synced 2026-02-17 19:11:22 -05:00
Removed the silly 'Node' suffix from everything.
This commit is contained in:
@@ -33,7 +33,7 @@ unwrap = /function\s*\(\)\s*\{\s*return\s*([\s\S]*);\s*\}/
|
||||
o = (patternString, action, options) ->
|
||||
return [patternString, '$$ = $1;', options] unless action
|
||||
action = if match = (action + '').match(unwrap) then match[1] else "(#{action}())"
|
||||
action = action.replace /\b(?:[A-Z][a-z]+Node|Expressions)\b/g, 'yy.$&'
|
||||
action = action.replace(/\bnew (\w+)\b/g, 'new yy.$1').replace(/Expressions\.wrap/g, 'yy.Expressions.wrap');
|
||||
[patternString, "$$ = #{action};", options]
|
||||
|
||||
# Grammatical Rules
|
||||
@@ -77,9 +77,9 @@ grammar =
|
||||
Statement: [
|
||||
o "Return"
|
||||
o "Throw"
|
||||
o "BREAK", -> new LiteralNode $1
|
||||
o "CONTINUE", -> new LiteralNode $1
|
||||
o "DEBUGGER", -> new LiteralNode $1
|
||||
o "BREAK", -> new Literal $1
|
||||
o "CONTINUE", -> new Literal $1
|
||||
o "DEBUGGER", -> new Literal $1
|
||||
]
|
||||
|
||||
# All the different types of expressions in our language. The basic unit of
|
||||
@@ -114,71 +114,71 @@ grammar =
|
||||
|
||||
# A literal identifier, a variable name or property.
|
||||
Identifier: [
|
||||
o "IDENTIFIER", -> new LiteralNode $1
|
||||
o "IDENTIFIER", -> new Literal $1
|
||||
]
|
||||
|
||||
# Alphanumerics are separated from the other **Literal** matchers because
|
||||
# they can also serve as keys in object literals.
|
||||
AlphaNumeric: [
|
||||
o "NUMBER", -> new LiteralNode $1
|
||||
o "STRING", -> new LiteralNode $1
|
||||
o "NUMBER", -> new Literal $1
|
||||
o "STRING", -> new Literal $1
|
||||
]
|
||||
|
||||
# All of our immediate values. These can (in general), be passed straight
|
||||
# through and printed to JavaScript.
|
||||
Literal: [
|
||||
o "AlphaNumeric"
|
||||
o "JS", -> new LiteralNode $1
|
||||
o "REGEX", -> new LiteralNode $1
|
||||
o "TRUE", -> new LiteralNode true
|
||||
o "FALSE", -> new LiteralNode false
|
||||
o "YES", -> new LiteralNode true
|
||||
o "NO", -> new LiteralNode false
|
||||
o "ON", -> new LiteralNode true
|
||||
o "OFF", -> new LiteralNode false
|
||||
o "JS", -> new Literal $1
|
||||
o "REGEX", -> new Literal $1
|
||||
o "TRUE", -> new Literal true
|
||||
o "FALSE", -> new Literal false
|
||||
o "YES", -> new Literal true
|
||||
o "NO", -> new Literal false
|
||||
o "ON", -> new Literal true
|
||||
o "OFF", -> new Literal false
|
||||
]
|
||||
|
||||
# Assignment of a variable, property, or index to a value.
|
||||
Assign: [
|
||||
o "Assignable = Expression", -> new AssignNode $1, $3
|
||||
o "Assignable = INDENT Expression OUTDENT", -> new AssignNode $1, $4
|
||||
o "Assignable = Expression", -> new Assign $1, $3
|
||||
o "Assignable = INDENT Expression OUTDENT", -> new Assign $1, $4
|
||||
]
|
||||
|
||||
# Assignment when it happens within an object literal. The difference from
|
||||
# the ordinary **Assign** is that these allow numbers and strings as keys.
|
||||
AssignObj: [
|
||||
o "Identifier", -> new ValueNode $1
|
||||
o "Identifier", -> new Value $1
|
||||
o "AlphaNumeric"
|
||||
o "ThisProperty"
|
||||
o "Identifier : Expression", -> new AssignNode new ValueNode($1), $3, 'object'
|
||||
o "AlphaNumeric : Expression", -> new AssignNode new ValueNode($1), $3, 'object'
|
||||
o "Identifier : INDENT Expression OUTDENT", -> new AssignNode new ValueNode($1), $4, 'object'
|
||||
o "AlphaNumeric : INDENT Expression OUTDENT", -> new AssignNode new ValueNode($1), $4, 'object'
|
||||
o "Identifier : Expression", -> new Assign new Value($1), $3, 'object'
|
||||
o "AlphaNumeric : Expression", -> new Assign new Value($1), $3, 'object'
|
||||
o "Identifier : INDENT Expression OUTDENT", -> new Assign new Value($1), $4, 'object'
|
||||
o "AlphaNumeric : INDENT Expression OUTDENT", -> new Assign new Value($1), $4, 'object'
|
||||
o "Comment"
|
||||
]
|
||||
|
||||
# A return statement from a function body.
|
||||
Return: [
|
||||
o "RETURN Expression", -> new ReturnNode $2
|
||||
o "RETURN", -> new ReturnNode
|
||||
o "RETURN Expression", -> new Return $2
|
||||
o "RETURN", -> new Return
|
||||
]
|
||||
|
||||
# A block comment.
|
||||
Comment: [
|
||||
o "HERECOMMENT", -> new CommentNode $1
|
||||
o "HERECOMMENT", -> new Comment $1
|
||||
]
|
||||
|
||||
# [The existential operator](http://jashkenas.github.com/coffee-script/#existence).
|
||||
Existence: [
|
||||
o "Expression ?", -> new ExistenceNode $1
|
||||
o "Expression ?", -> new Existence $1
|
||||
]
|
||||
|
||||
# The **Code** node is the function literal. It's defined by an indented block
|
||||
# of **Expressions** preceded by a function arrow, with an optional parameter
|
||||
# list.
|
||||
Code: [
|
||||
o "PARAM_START ParamList PARAM_END FuncGlyph Block", -> new CodeNode $2, $5, $4
|
||||
o "FuncGlyph Block", -> new CodeNode [], $2, $1
|
||||
o "PARAM_START ParamList PARAM_END FuncGlyph Block", -> new Code $2, $5, $4
|
||||
o "FuncGlyph Block", -> new Code [], $2, $1
|
||||
]
|
||||
|
||||
# CoffeeScript has two different symbols for functions. `->` is for ordinary
|
||||
@@ -204,64 +204,64 @@ grammar =
|
||||
# A single parameter in a function definition can be ordinary, or a splat
|
||||
# that hoovers up the remaining arguments.
|
||||
Param: [
|
||||
o "PARAM", -> new LiteralNode $1
|
||||
o "@ PARAM", -> new ParamNode $2, true
|
||||
o "PARAM . . .", -> new ParamNode $1, false, true
|
||||
o "@ PARAM . . .", -> new ParamNode $2, true, true
|
||||
o "PARAM", -> new Literal $1
|
||||
o "@ PARAM", -> new Param $2, true
|
||||
o "PARAM . . .", -> new Param $1, false, true
|
||||
o "@ PARAM . . .", -> new Param $2, true, true
|
||||
]
|
||||
|
||||
# A splat that occurs outside of a parameter list.
|
||||
Splat: [
|
||||
o "Expression . . .", -> new SplatNode $1
|
||||
o "Expression . . .", -> new Splat $1
|
||||
]
|
||||
|
||||
# Variables and properties that can be assigned to.
|
||||
SimpleAssignable: [
|
||||
o "Identifier", -> new ValueNode $1
|
||||
o "Identifier", -> new Value $1
|
||||
o "Value Accessor", -> $1.push $2
|
||||
o "Invocation Accessor", -> new ValueNode $1, [$2]
|
||||
o "Invocation Accessor", -> new Value $1, [$2]
|
||||
o "ThisProperty"
|
||||
]
|
||||
|
||||
# Everything that can be assigned to.
|
||||
Assignable: [
|
||||
o "SimpleAssignable"
|
||||
o "Array", -> new ValueNode $1
|
||||
o "Object", -> new ValueNode $1
|
||||
o "Array", -> new Value $1
|
||||
o "Object", -> new Value $1
|
||||
]
|
||||
|
||||
# The types of things that can be treated as values -- assigned to, invoked
|
||||
# as functions, indexed into, named as a class, etc.
|
||||
Value: [
|
||||
o "Assignable"
|
||||
o "Literal", -> new ValueNode $1
|
||||
o "Parenthetical", -> new ValueNode $1
|
||||
o "Range", -> new ValueNode $1
|
||||
o "Literal", -> new Value $1
|
||||
o "Parenthetical", -> new Value $1
|
||||
o "Range", -> new Value $1
|
||||
o "This"
|
||||
o "NULL", -> new ValueNode new LiteralNode 'null'
|
||||
o "NULL", -> new Value new Literal 'null'
|
||||
]
|
||||
|
||||
# The general group of accessors into an object, by property, by prototype
|
||||
# or by array index or slice.
|
||||
Accessor: [
|
||||
o "PROPERTY_ACCESS Identifier", -> new AccessorNode $2
|
||||
o "PROTOTYPE_ACCESS Identifier", -> new AccessorNode $2, 'prototype'
|
||||
o "::", -> new AccessorNode(new LiteralNode('prototype'))
|
||||
o "SOAK_ACCESS Identifier", -> new AccessorNode $2, 'soak'
|
||||
o "PROPERTY_ACCESS Identifier", -> new Accessor $2
|
||||
o "PROTOTYPE_ACCESS Identifier", -> new Accessor $2, 'prototype'
|
||||
o "::", -> new Accessor(new Literal('prototype'))
|
||||
o "SOAK_ACCESS Identifier", -> new Accessor $2, 'soak'
|
||||
o "Index"
|
||||
o "Slice", -> new SliceNode $1
|
||||
o "Slice", -> new Slice $1
|
||||
]
|
||||
|
||||
# Indexing into an object or array using bracket notation.
|
||||
Index: [
|
||||
o "INDEX_START Expression INDEX_END", -> new IndexNode $2
|
||||
o "INDEX_START Expression INDEX_END", -> new Index $2
|
||||
o "INDEX_SOAK Index", -> $2.soakNode = yes; $2
|
||||
o "INDEX_PROTO Index", -> $2.proto = yes; $2
|
||||
]
|
||||
|
||||
# In CoffeeScript, an object literal is simply a list of assignments.
|
||||
Object: [
|
||||
o "{ AssignList OptComma }", -> new ObjectNode $2
|
||||
o "{ AssignList OptComma }", -> new ObjectLiteral $2
|
||||
]
|
||||
|
||||
# Assignment of properties within an object literal can be separated by
|
||||
@@ -277,21 +277,21 @@ grammar =
|
||||
# Class definitions have optional bodies of prototype property assignments,
|
||||
# and optional references to the superclass.
|
||||
Class: [
|
||||
o "CLASS SimpleAssignable", -> new ClassNode $2
|
||||
o "CLASS SimpleAssignable EXTENDS Value", -> new ClassNode $2, $4
|
||||
o "CLASS SimpleAssignable INDENT ClassBody OUTDENT", -> new ClassNode $2, null, $4
|
||||
o "CLASS SimpleAssignable EXTENDS Value INDENT ClassBody OUTDENT", -> new ClassNode $2, $4, $6
|
||||
o "CLASS INDENT ClassBody OUTDENT", -> new ClassNode '__temp__', null, $3
|
||||
o "CLASS", -> new ClassNode '__temp__', null, new Expressions
|
||||
o "CLASS EXTENDS Value", -> new ClassNode '__temp__', $3, new Expressions
|
||||
o "CLASS EXTENDS Value INDENT ClassBody OUTDENT", -> new ClassNode '__temp__', $3, $5
|
||||
o "CLASS SimpleAssignable", -> new Class $2
|
||||
o "CLASS SimpleAssignable EXTENDS Value", -> new Class $2, $4
|
||||
o "CLASS SimpleAssignable INDENT ClassBody OUTDENT", -> new Class $2, null, $4
|
||||
o "CLASS SimpleAssignable EXTENDS Value INDENT ClassBody OUTDENT", -> new Class $2, $4, $6
|
||||
o "CLASS INDENT ClassBody OUTDENT", -> new Class '__temp__', null, $3
|
||||
o "CLASS", -> new Class '__temp__', null, new Expressions
|
||||
o "CLASS EXTENDS Value", -> new Class '__temp__', $3, new Expressions
|
||||
o "CLASS EXTENDS Value INDENT ClassBody OUTDENT", -> new Class '__temp__', $3, $5
|
||||
]
|
||||
|
||||
# Assignments that can happen directly inside a class declaration.
|
||||
ClassAssign: [
|
||||
o "AssignObj", -> $1
|
||||
o "ThisProperty : Expression", -> new AssignNode new ValueNode($1), $3, 'this'
|
||||
o "ThisProperty : INDENT Expression OUTDENT", -> new AssignNode new ValueNode($1), $4, 'this'
|
||||
o "ThisProperty : Expression", -> new Assign new Value($1), $3, 'this'
|
||||
o "ThisProperty : INDENT Expression OUTDENT", -> new Assign new Value($1), $4, 'this'
|
||||
]
|
||||
|
||||
# A list of assignments to a class.
|
||||
@@ -305,15 +305,15 @@ grammar =
|
||||
# Extending an object by setting its prototype chain to reference a parent
|
||||
# object.
|
||||
Extends: [
|
||||
o "SimpleAssignable EXTENDS Value", -> new ExtendsNode $1, $3
|
||||
o "SimpleAssignable EXTENDS Value", -> new Extends $1, $3
|
||||
]
|
||||
|
||||
# Ordinary function invocation, or a chained series of calls.
|
||||
Invocation: [
|
||||
o "Value OptFuncExist Arguments", -> new CallNode $1, $3, $2
|
||||
o "Invocation OptFuncExist Arguments", -> new CallNode $1, $3, $2
|
||||
o "SUPER", -> new CallNode 'super', [new SplatNode(new LiteralNode('arguments'))]
|
||||
o "SUPER Arguments", -> new CallNode 'super', $2
|
||||
o "Value OptFuncExist Arguments", -> new Call $1, $3, $2
|
||||
o "Invocation OptFuncExist Arguments", -> new Call $1, $3, $2
|
||||
o "SUPER", -> new Call 'super', [new Splat(new Literal('arguments'))]
|
||||
o "SUPER Arguments", -> new Call 'super', $2
|
||||
]
|
||||
|
||||
# An optional existence check on a function.
|
||||
@@ -330,8 +330,8 @@ grammar =
|
||||
|
||||
# A reference to the *this* current object.
|
||||
This: [
|
||||
o "THIS", -> new ValueNode new LiteralNode 'this'
|
||||
o "@", -> new ValueNode new LiteralNode 'this'
|
||||
o "THIS", -> new Value new Literal 'this'
|
||||
o "@", -> new Value new Literal 'this'
|
||||
]
|
||||
|
||||
RangeDots: [
|
||||
@@ -341,25 +341,25 @@ grammar =
|
||||
|
||||
# A reference to a property on *this*.
|
||||
ThisProperty: [
|
||||
o "@ Identifier", -> new ValueNode new LiteralNode('this'), [new AccessorNode($2)], 'this'
|
||||
o "@ Identifier", -> new Value new Literal('this'), [new Accessor($2)], 'this'
|
||||
]
|
||||
|
||||
# The CoffeeScript range literal.
|
||||
Range: [
|
||||
o "[ Expression RangeDots Expression ]", -> new RangeNode $2, $4, $3
|
||||
o "[ Expression RangeDots Expression ]", -> new Range $2, $4, $3
|
||||
]
|
||||
|
||||
# The slice literal.
|
||||
Slice: [
|
||||
o "INDEX_START Expression RangeDots Expression INDEX_END", -> new RangeNode $2, $4, $3
|
||||
o "INDEX_START Expression RangeDots INDEX_END", -> new RangeNode $2, null, $3
|
||||
o "INDEX_START RangeDots Expression INDEX_END", -> new RangeNode null, $3, $2
|
||||
o "INDEX_START Expression RangeDots Expression INDEX_END", -> new Range $2, $4, $3
|
||||
o "INDEX_START Expression RangeDots INDEX_END", -> new Range $2, null, $3
|
||||
o "INDEX_START RangeDots Expression INDEX_END", -> new Range null, $3, $2
|
||||
]
|
||||
|
||||
# The array literal.
|
||||
Array: [
|
||||
o "[ ]", -> new ArrayNode []
|
||||
o "[ ArgList OptComma ]", -> new ArrayNode $2
|
||||
o "[ ]", -> new ArrayLiteral []
|
||||
o "[ ArgList OptComma ]", -> new ArrayLiteral $2
|
||||
]
|
||||
|
||||
# The **ArgList** is both the list of objects passed into a function call,
|
||||
@@ -390,10 +390,10 @@ grammar =
|
||||
|
||||
# The variants of *try/catch/finally* exception handling blocks.
|
||||
Try: [
|
||||
o "TRY Block", -> new TryNode $2
|
||||
o "TRY Block Catch", -> new TryNode $2, $3[0], $3[1]
|
||||
o "TRY Block FINALLY Block", -> new TryNode $2, null, null, $4
|
||||
o "TRY Block Catch FINALLY Block", -> new TryNode $2, $3[0], $3[1], $5
|
||||
o "TRY Block", -> new Try $2
|
||||
o "TRY Block Catch", -> new Try $2, $3[0], $3[1]
|
||||
o "TRY Block FINALLY Block", -> new Try $2, null, null, $4
|
||||
o "TRY Block Catch FINALLY Block", -> new Try $2, $3[0], $3[1], $5
|
||||
]
|
||||
|
||||
# A catch clause names its error and runs a block of code.
|
||||
@@ -403,7 +403,7 @@ grammar =
|
||||
|
||||
# Throw an exception object.
|
||||
Throw: [
|
||||
o "THROW Expression", -> new ThrowNode $2
|
||||
o "THROW Expression", -> new Throw $2
|
||||
]
|
||||
|
||||
# Parenthetical expressions. Note that the **Parenthetical** is a **Value**,
|
||||
@@ -411,16 +411,16 @@ grammar =
|
||||
# where only values are accepted, wrapping it in parentheses will always do
|
||||
# the trick.
|
||||
Parenthetical: [
|
||||
o "( Line )", -> new ParentheticalNode $2
|
||||
o "( )", -> new ParentheticalNode new LiteralNode ''
|
||||
o "( Line )", -> new Parenthetical $2
|
||||
o "( )", -> new Parenthetical new Literal ''
|
||||
]
|
||||
|
||||
# The condition portion of a while loop.
|
||||
WhileSource: [
|
||||
o "WHILE Expression", -> new WhileNode $2
|
||||
o "WHILE Expression WHEN Expression", -> new WhileNode $2, guard: $4
|
||||
o "UNTIL Expression", -> new WhileNode $2, invert: true
|
||||
o "UNTIL Expression WHEN Expression", -> new WhileNode $2, invert: true, guard: $4
|
||||
o "WHILE Expression", -> new While $2
|
||||
o "WHILE Expression WHEN Expression", -> new While $2, guard: $4
|
||||
o "UNTIL Expression", -> new While $2, invert: true
|
||||
o "UNTIL Expression WHEN Expression", -> new While $2, invert: true, guard: $4
|
||||
]
|
||||
|
||||
# The while loop can either be normal, with a block of expressions to execute,
|
||||
@@ -433,21 +433,21 @@ grammar =
|
||||
]
|
||||
|
||||
Loop: [
|
||||
o "LOOP Block", -> new WhileNode(new LiteralNode 'true').addBody $2
|
||||
o "LOOP Expression", -> new WhileNode(new LiteralNode 'true').addBody Expressions.wrap [$2]
|
||||
o "LOOP Block", -> new While(new Literal 'true').addBody $2
|
||||
o "LOOP Expression", -> new While(new Literal 'true').addBody Expressions.wrap [$2]
|
||||
]
|
||||
|
||||
# Array, object, and range comprehensions, at the most generic level.
|
||||
# Comprehensions can either be normal, with a block of expressions to execute,
|
||||
# or postfix, with a single expression.
|
||||
For: [
|
||||
o "Statement ForBody", -> new ForNode $1, $2, $2.vars[0], $2.vars[1]
|
||||
o "Expression ForBody", -> new ForNode $1, $2, $2.vars[0], $2.vars[1]
|
||||
o "ForBody Block", -> new ForNode $2, $1, $1.vars[0], $1.vars[1]
|
||||
o "Statement ForBody", -> new For $1, $2, $2.vars[0], $2.vars[1]
|
||||
o "Expression ForBody", -> new For $1, $2, $2.vars[0], $2.vars[1]
|
||||
o "ForBody Block", -> new For $2, $1, $1.vars[0], $1.vars[1]
|
||||
]
|
||||
|
||||
ForBody: [
|
||||
o "FOR Range", -> source: new ValueNode($2), vars: []
|
||||
o "FOR Range", -> source: new Value($2), vars: []
|
||||
o "ForStart ForSource", -> $2.raw = $1.raw; $2.vars = $1; $2
|
||||
]
|
||||
|
||||
@@ -460,8 +460,8 @@ grammar =
|
||||
# enables support for pattern matching.
|
||||
ForValue: [
|
||||
o "Identifier"
|
||||
o "Array", -> new ValueNode $1
|
||||
o "Object", -> new ValueNode $1
|
||||
o "Array", -> new Value $1
|
||||
o "Object", -> new Value $1
|
||||
]
|
||||
|
||||
# An array or range comprehension has variables for the current element and
|
||||
@@ -486,10 +486,10 @@ grammar =
|
||||
]
|
||||
|
||||
Switch: [
|
||||
o "SWITCH Expression INDENT Whens OUTDENT", -> new SwitchNode $2, $4
|
||||
o "SWITCH Expression INDENT Whens ELSE Block OUTDENT", -> new SwitchNode $2, $4, $6
|
||||
o "SWITCH INDENT Whens OUTDENT", -> new SwitchNode null, $3
|
||||
o "SWITCH INDENT Whens ELSE Block OUTDENT", -> new SwitchNode null, $3, $5
|
||||
o "SWITCH Expression INDENT Whens OUTDENT", -> new Switch $2, $4
|
||||
o "SWITCH Expression INDENT Whens ELSE Block OUTDENT", -> new Switch $2, $4, $6
|
||||
o "SWITCH INDENT Whens OUTDENT", -> new Switch null, $3
|
||||
o "SWITCH INDENT Whens ELSE Block OUTDENT", -> new Switch null, $3, $5
|
||||
]
|
||||
|
||||
Whens: [
|
||||
@@ -507,9 +507,9 @@ grammar =
|
||||
# if-related rules are broken up along these lines in order to avoid
|
||||
# ambiguity.
|
||||
IfBlock: [
|
||||
o "IF Expression Block", -> new IfNode $2, $3
|
||||
o "UNLESS Expression Block", -> new IfNode $2, $3, invert: true
|
||||
o "IfBlock ELSE IF Expression Block", -> $1.addElse new IfNode $4, $5
|
||||
o "IF Expression Block", -> new If $2, $3
|
||||
o "UNLESS Expression Block", -> new If $2, $3, invert: true
|
||||
o "IfBlock ELSE IF Expression Block", -> $1.addElse new If $4, $5
|
||||
o "IfBlock ELSE Block", -> $1.addElse $3
|
||||
]
|
||||
|
||||
@@ -517,10 +517,10 @@ grammar =
|
||||
# *if* and *unless*.
|
||||
If: [
|
||||
o "IfBlock"
|
||||
o "Statement POST_IF Expression", -> new IfNode $3, Expressions.wrap([$1]), statement: true
|
||||
o "Expression POST_IF Expression", -> new IfNode $3, Expressions.wrap([$1]), statement: true
|
||||
o "Statement POST_UNLESS Expression", -> new IfNode $3, Expressions.wrap([$1]), statement: true, invert: true
|
||||
o "Expression POST_UNLESS Expression", -> new IfNode $3, Expressions.wrap([$1]), statement: true, invert: true
|
||||
o "Statement POST_IF Expression", -> new If $3, Expressions.wrap([$1]), statement: true
|
||||
o "Expression POST_IF Expression", -> new If $3, Expressions.wrap([$1]), statement: true
|
||||
o "Statement POST_UNLESS Expression", -> new If $3, Expressions.wrap([$1]), statement: true, invert: true
|
||||
o "Expression POST_UNLESS Expression", -> new If $3, Expressions.wrap([$1]), statement: true, invert: true
|
||||
]
|
||||
|
||||
# Arithmetic and logical operators, working on one or more operands.
|
||||
@@ -530,36 +530,36 @@ grammar =
|
||||
# -type rule, but in order to make the precedence binding possible, separate
|
||||
# rules are necessary.
|
||||
Operation: [
|
||||
o "UNARY Expression", -> new OpNode $1, $2
|
||||
o("- Expression", (-> new OpNode('-', $2)), {prec: 'UNARY'})
|
||||
o("+ Expression", (-> new OpNode('+', $2)), {prec: 'UNARY'})
|
||||
o "UNARY Expression", -> new Op $1, $2
|
||||
o("- Expression", (-> new Op('-', $2)), {prec: 'UNARY'})
|
||||
o("+ Expression", (-> new Op('+', $2)), {prec: 'UNARY'})
|
||||
|
||||
o "-- Expression", -> new OpNode '--', $2
|
||||
o "++ Expression", -> new OpNode '++', $2
|
||||
o "Expression --", -> new OpNode '--', $1, null, true
|
||||
o "Expression ++", -> new OpNode '++', $1, null, true
|
||||
o "-- Expression", -> new Op '--', $2
|
||||
o "++ Expression", -> new Op '++', $2
|
||||
o "Expression --", -> new Op '--', $1, null, true
|
||||
o "Expression ++", -> new Op '++', $1, null, true
|
||||
|
||||
o "Expression ? Expression", -> new OpNode '?', $1, $3
|
||||
o "Expression + Expression", -> new OpNode '+', $1, $3
|
||||
o "Expression - Expression", -> new OpNode '-', $1, $3
|
||||
o "Expression == Expression", -> new OpNode '==', $1, $3
|
||||
o "Expression != Expression", -> new OpNode '!=', $1, $3
|
||||
o "Expression ? Expression", -> new Op '?', $1, $3
|
||||
o "Expression + Expression", -> new Op '+', $1, $3
|
||||
o "Expression - Expression", -> new Op '-', $1, $3
|
||||
o "Expression == Expression", -> new Op '==', $1, $3
|
||||
o "Expression != Expression", -> new Op '!=', $1, $3
|
||||
|
||||
o "Expression MATH Expression", -> new OpNode $2, $1, $3
|
||||
o "Expression SHIFT Expression", -> new OpNode $2, $1, $3
|
||||
o "Expression COMPARE Expression", -> new OpNode $2, $1, $3
|
||||
o "Expression LOGIC Expression", -> new OpNode $2, $1, $3
|
||||
o "Value COMPOUND_ASSIGN Expression", -> new OpNode $2, $1, $3
|
||||
o "Value COMPOUND_ASSIGN INDENT Expression OUTDENT", -> new OpNode $2, $1, $4
|
||||
o "Expression MATH Expression", -> new Op $2, $1, $3
|
||||
o "Expression SHIFT Expression", -> new Op $2, $1, $3
|
||||
o "Expression COMPARE Expression", -> new Op $2, $1, $3
|
||||
o "Expression LOGIC Expression", -> new Op $2, $1, $3
|
||||
o "Value COMPOUND_ASSIGN Expression", -> new Op $2, $1, $3
|
||||
o "Value COMPOUND_ASSIGN INDENT Expression OUTDENT", -> new Op $2, $1, $4
|
||||
|
||||
o "Expression RELATION Expression", ->
|
||||
if $2.charAt(0) is '!'
|
||||
if $2 is '!in'
|
||||
new OpNode '!', new InNode $1, $3
|
||||
new Op '!', new In $1, $3
|
||||
else
|
||||
new OpNode '!', new ParentheticalNode new OpNode $2[1..], $1, $3
|
||||
new Op '!', new Parenthetical new Op $2[1..], $1, $3
|
||||
else
|
||||
if $2 is 'in' then new InNode $1, $3 else new OpNode $2, $1, $3
|
||||
if $2 is 'in' then new In $1, $3 else new Op $2, $1, $3
|
||||
]
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user