Advertisement
Guest User

Untitled

a guest
Jul 24th, 2010
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 1.91 KB | None | 0 0
  1.  
  2. diff --git a/src/NQP/Grammar.pm b/src/NQP/Grammar.pm
  3. index 3007cb3..5f5f1d0 100644
  4. --- a/src/NQP/Grammar.pm
  5. +++ b/src/NQP/Grammar.pm
  6. @@ -457,7 +457,7 @@ INIT {
  7.      NQP::Grammar.O(':prec<k=>, :assoc<left>',  '%tight_or');
  8.      NQP::Grammar.O(':prec<j=>, :assoc<right>', '%conditional');
  9.      NQP::Grammar.O(':prec<i=>, :assoc<right>', '%assignment');
  10. -    NQP::Grammar.O(':prec<g=>, :assoc<list>, :nextterm<nulltermish>',  '%comma');
  11. +    NQP::Grammar.O(':prec<g=>, :assoc<list>, :lastterm<nulltermish>',  '%comma');
  12.      NQP::Grammar.O(':prec<f=>, :assoc<list>',  '%list_infix');
  13.      NQP::Grammar.O(':prec<e=>, :assoc<unary>', '%list_prefix');
  14.  }
  15. diff --git a/src/cheats/hll-grammar.pir b/src/cheats/hll-grammar.pir
  16. index c616b03..cebccef 100644
  17. --- a/src/cheats/hll-grammar.pir
  18. +++ b/src/cheats/hll-grammar.pir
  19. @@ -439,9 +439,20 @@ An operator precedence parser.
  20.      .local pmc here, from, pos
  21.      (here, pos) = self.'!cursor_start'()
  22.  
  23. +    .local pmc oldhere # oha
  24. +    .local int is_last # oha
  25. +    .local string lasttermishrx # oha
  26. +    is_last = 0 # oha
  27.    term_loop:
  28. +    oldhere = here # oha
  29.      here = here.termishrx()
  30. +    if here goto found_termish # oha
  31. +    #unless here goto fail # oha
  32. +    termishrx = lasttermishrx
  33. +    here = oldhere.termishrx()
  34.      unless here goto fail
  35. +    inc is_last
  36. +  found_termish: # oha
  37.      .local pmc termish
  38.      termish = here.'MATCH'()
  39.  
  40. @@ -505,6 +516,8 @@ An operator precedence parser.
  41.      $P0 = termish['term']
  42.      push termstack, $P0
  43.  
  44. +    if is_last > 0 goto term_done # oha
  45. +
  46.      # Now see if we can fetch an infix operator
  47.      .local pmc infixcur, infix
  48.      here = here.'ws'()
  49. @@ -515,6 +528,7 @@ An operator precedence parser.
  50.      .local pmc inO
  51.      $P0 = infix['OPER']
  52.      inO = $P0['O']
  53. +    lasttermishrx = inO['lastterm'] # oha
  54.      termishrx = inO['nextterm']
  55.      if termishrx goto have_termishrx
  56.      termishrx = 'termish'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement