[ruby-cvs:67961] yui-knk:r60780 (trunk): parse.y: Preserve previous line and restore it when read '\n'

yui-knk at ruby-lang.org yui-knk at ruby-lang.org
Thu Nov 16 10:06:10 JST 2017


yui-knk	2017-11-16 10:06:10 +0900 (Thu, 16 Nov 2017)

  New Revision: 60780

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=60780

  Log:
    parse.y: Preserve previous line and restore it when read '\n'
    
    * parse.y (parser_params): Add prevline to store previous line.
    * parse.y (yycompile0): Initialize prevline with 0.
    * parse.y (parser_nextline): Store previous line on prevline.
    * parse.y (parser_nextc): Check parser is on EOF or has nextline.
      Now parser_yylex does not always set lex_p as lex_pend, we should check
      EOF flag and nextline is set.
    * parse.y (parser_yylex): Restore previous line, set lex_p and tokp
      on '\n'. Before this commit, tokp is on the head of next line of '\n'
      and lex_p is on the tail of next line when next token is '\n'.
      By this behavior, in some case the last column of NODE_CALL (or NODE_QCALL) is
      set to the last column of next line. NODE_CALL can be generated
      via `primary_value call_op operation2 {} opt_paren_args` and opt_paren_args
      can be none. If none is generated with next token '\n', the last column of
      none is set to the last column of next line.
    
      e.g. :
    
      ```
      a.b
      cd.ef
      ```
    
      The location of NODE_CALL of first line is set to,
    
      * Before
    
      ```
      NODE_CALL (line: 1, first_lineno: 1, first_column: 0, last_lineno: 1, last_column: 6)
      ```
    
      * After
    
      ```
      NODE_CALL (line: 1, first_lineno: 1, first_column: 0, last_lineno: 1, last_column: 3)
      ```
    
    * parse.y (parser_mark): GC mark prevline.

  Modified files:
    trunk/parse.y


More information about the ruby-cvs mailing list