Changes between Version 22 and Version 23 of PIRCDevelopment

Show
Ignore:
Timestamp:
08/09/09 09:52:11 (12 years ago)
Author:
kjs
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • PIRCDevelopment

    v22 v23  
    184184 1. "end-of-line" characters, basically an empty line (see [source:/trunk/compilers/pirc/src/hdocprep.l#L357 line 357]). An escaped newline character ("\\n") will be stored as part of the heredoc string. 
    185185 
    186  2. "normal" heredoc string lines (see [source:/trunk/compilers/pirc/src/hdocprep.l#L376 line 376]. First the newline character is removed, because we may have found the heredoc string delimiter, that was stored earlier. In order to compare the strings, the newline character is chopped off (see [source:/trunk/compilers/pirc/src/hdocprep.l#L381 lines 381-384]). Then, a string comparison is done in order to see whether we just read the heredoc string delimiter. If so, then we need to continue scanning the "rest of the line" that was saved earlier. However, since we need to switch back later to the current buffer, we need to store this current buffer ([source:/trunk/compilers/pirc/src/hdocprep.l#L395 line 395]). Also, the lexer's state is changed to SCAN_STRING, since we're going to scan a saved string. Then, the lexer's told to read the next input from the string buffer ([source:/trunk/compilers/pirc/src/hdocprep.l#L406 line 406]). 
    187  
     186 2. "normal" heredoc string lines (see [source:/trunk/compilers/pirc/src/hdocprep.l#L376 line 376]. First the newline character is removed, because we may have found the heredoc string delimiter, that was stored earlier. In order to compare the strings, the newline character is chopped off (see [source:/trunk/compilers/pirc/src/hdocprep.l#L381 lines 381-384]). Then, a string comparison is done in order to see whether we just read the heredoc string delimiter. If so, then we need to continue scanning the "rest of the line" that was saved earlier. However, since we need to switch back later to the current buffer, we need to store this current buffer ([source:/trunk/compilers/pirc/src/hdocprep.l#L395 line 395]). Also, the lexer's state is changed to SCAN_STRING, since we're going to scan a saved string. Then, the lexer's told to read the next input from the string buffer ([source:/trunk/compilers/pirc/src/hdocprep.l#L406 line 406]). If however, we did not read the heredoc delimiter, then it's just a line that's part of the heredoc string, which needs to be stored. In that case, a new buffer is allocated to store the heredoc string so far, plus the new line that's just been scanned. The old buffer is released. 
     187 
     188 
     189 3. End of file ([source:/trunk/compilers/pirc/src/hdocprep.l#L423 line 423]). When the lexer encounters end-of-file, an error is printed to the screen, and the lexer terminates. 
     190 
     191 
     192Once the heredoc string has been completely scanned, the SCAN_STRING state is activated. Again, there's a number of different input patterns that may be scanned: 
     193 
     194 1. Another heredoc marker (<<{Q_STRING}, [source:/trunk/compilers/pirc/src/hdocprep.l#L428 line 428]). See Scenario 2 for a discussion of this. 
     195 
     196 2. End of line ([source:/trunk/compilers/pirc/src/hdocprep.l#L447 line 447]). Nothing is done. 
     197 
     198 3. Any character ([source:/trunk/compilers/pirc/src/hdocprep.l#L449 line 449]). The character (for instance, a parenthesis) is written to the output. 
     199 
     200 4. End of file ([source:/trunk/compilers/pirc/src/hdocprep.l#L451 line 451]). End of file, in this context, means end of string. So, we've finished scanning the "rest of line" string buffer, so now the lexer needs to switch back to read the next input from the file again. Also, the lexer's state is switched back to the default state (INITIAL). 
     201 
     202This completes the processing of a single heredoc string. 
    188203 
    189204==== Scenario 1b: single heredoc argument parsing ====