Changes between Version 25 and Version 26 of PIRCDevelopment

Show
Ignore:
Timestamp:
08/09/09 10:33:00 (12 years ago)
Author:
kjs
Comment:

finish discussion heredoc parser.

Legend:

Unmodified
Added
Removed
Modified
  • PIRCDevelopment

    v25 v26  
    255255}}} 
    256256    
     257First the comma and whitespace is scanned, handled by [source:/trunk/compilers/pirc/src/hdocprep.l#L449 line 449]. Then the argument "42" is matched ([source:/trunk/compilers/pirc/src/hdocprep.l#L449 line 449], "any character") as well as the comma. 
     258 
     259Then the heredoc marker for heredoc B is scanned ([source:/trunk/compilers/pirc/src/hdocprep.l#L428 line 428]). This section of code is almost similar to the section that matches heredoc markers in the INITIAL state ([source:/trunk/compilers/pirc/src/hdocprep.l#L306 line 306]). The difference is that instead of activating SAVE_REST_OF_LINE state, the SAVE_REST_AGAIN state is activated. SAVE_REST_AGAIN is almost the same to SAVE_REST_OF_LINE state. The difference is, that in SAVE_REST_OF_LINE, the lexer is still reading from the file buffer, whereas when the lexer is in SAVE_REST_AGAIN, it is scanning a string buffer. Therefore, the lexer must switch from the string buffer to reading the file buffer, which is done in [source:/trunk/compilers/pirc/src/hdocprep.l#L350 line 350]. 
     260 
     261At this point, heredoc string B is scanned. After that, heredoc string C is scanned. It is left as the proverbial exercise to the reader to try to understand how this is done. The previous discussion of the involved lexer states should greatly help in this. 
    257262 
    258263==== POD parsing ====