Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: opal/opal
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 3ceee6dd4929
Choose a base ref
...
head repository: opal/opal
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: ff76470a85ee
Choose a head ref
  • 3 commits
  • 3 files changed
  • 1 contributor

Commits on Nov 17, 2013

  1. Copy the full SHA
    270c452 View commit details
  2. Copy the full SHA
    e9aee5f View commit details
  3. Copy the full SHA
    ff76470 View commit details
Showing with 1,586 additions and 1,583 deletions.
  1. +1,575 −1,573 lib/opal/parser/grammar.rb
  2. +8 −7 lib/opal/parser/grammar.y
  3. +3 −3 lib/opal/parser/lexer.rb
3,148 changes: 1,575 additions & 1,573 deletions lib/opal/parser/grammar.rb

Large diffs are not rendered by default.

15 changes: 8 additions & 7 deletions lib/opal/parser/grammar.y
Original file line number Diff line number Diff line change
@@ -10,11 +10,12 @@ token kCLASS kMODULE kDEF kUNDEF kBEGIN kRESCUE kENSURE kEND kIF kUNLESS
'-@' '-@NUM' tPOW tCMP tEQ tEQQ tNEQ tGEQ tLEQ tANDOP
tOROP tMATCH tNMATCH '.' tDOT2 tDOT3 '[]' '[]=' tLSHFT tRSHFT
'::' '::@' tOP_ASGN tASSOC tLPAREN '(' ')' tLPAREN_ARG
ARRAY_BEG ']' tLBRACE tLBRACE_ARG tSTAR tSTAR2 '&@' tAMPER2
ARRAY_BEG tRBRACK tLBRACE tLBRACE_ARG tSTAR tSTAR2 '&@' tAMPER2
tTILDE tPERCENT tDIVIDE '+' '-' tLT tGT tPIPE tBANG tCARET
tLCURLY tRCURLY tBACK_REF2 tSYMBEG tSTRING_BEG tXSTRING_BEG tREGEXP_BEG
tWORDS_BEG tAWORDS_BEG tSTRING_DBEG tSTRING_DVAR tSTRING_END tSTRING
tSYMBOL '\\n' tEH tCOLON ',' tSPACE ';' tLABEL tLAMBDA tLAMBEG kDO_LAMBDA
tLBRACK2 tLBRACK

prechigh
right tBANG tTILDE '+@'
@@ -163,7 +164,7 @@ rule
{
result = new_op_asgn val[1].intern, val[0], val[2]
}
| primary_value '[@' aref_args ']' tOP_ASGN command_call
| primary_value tLBRACK2 aref_args tRBRACK tOP_ASGN command_call
| primary_value '.' tIDENTIFIER tOP_ASGN command_call
{
result = s(:op_asgn2, val[0], "#{val[2]}=".intern, val[3].intern, val[4])
@@ -331,7 +332,7 @@ rule
{
result = new_assignable val[0]
}
| primary_value '[@' aref_args ']'
| primary_value tLBRACK2 aref_args tRBRACK
{
args = val[2]
args.type = :arglist if args.type == :array
@@ -351,7 +352,7 @@ rule
{
result = new_assignable val[0]
}
| primary_value '[@' aref_args ']'
| primary_value tLBRACK2 aref_args tRBRACK
{
args = val[2]
args.type = :arglist if args.type == :array
@@ -450,7 +451,7 @@ rule
{
result = new_op_asgn val[1].intern, val[0], val[2]
}
| primary_value '[@' aref_args ']' tOP_ASGN arg
| primary_value tLBRACK2 aref_args tRBRACK tOP_ASGN arg
{
args = val[2]
args.type = :arglist if args.type == :array
@@ -768,11 +769,11 @@ rule
{
result = s(:colon3, val[1])
}
| primary_value '[@' aref_args ']'
| primary_value tLBRACK2 aref_args tRBRACK
{
result = new_call val[0], :[], val[2]
}
| '[' aref_args ']'
| tLBRACK aref_args tRBRACK
{
result = val[1] || s(:array)
}
6 changes: 3 additions & 3 deletions lib/opal/parser/lexer.rb
Original file line number Diff line number Diff line change
@@ -812,19 +812,19 @@ def yylex
@lex_state = :expr_beg
cond_push 0
cmdarg_push 0
return '[', scanner.matched
return :tLBRACK, scanner.matched
else
@lex_state = :expr_beg
cond_push 0
cmdarg_push 0
return '[@', scanner.matched
return :tLBRACK2, scanner.matched
end

elsif scan(/\]/)
cond_lexpop
cmdarg_lexpop
@lex_state = :expr_end
return ']', scanner.matched
return :tRBRACK, scanner.matched

elsif scan(/\}/)
cond_lexpop