Terrot Francois - 2013-06-06

Hi
I have also experimented this issue.
Please find here after the description of the "ugly" patch I did on my side:
In readRegexp() from AwkParser.java I just add a check to make sure an escaped / is taken into account (lines FIXME: are the one I added)

private void readRegexp()
   throws IOException {

// should only contain nothing or =, depending on whether
// starting with /... or /=...
assert regexp.length()==0 || regexp.length()==1;
while(c >= 0 && c != '/' && c != '\n') {
    /* FIXME:Just to be able to to include / in the pattern 
     * FIXME:In case of \ force to read the one character more:
     * FIXME:- if second is not /, append the two characters to regexp buffer
     * FIXME:- if a / is read, only the / is append. */
    if (c== '\\') {                          /* FIXME: */
        c = reader.read();               /* FIXME: */
        if (c!='/') regexp.append('\\'); /* FIXME: */
    }                                        /* FIXME: */
    regexp.append((char)c);
    c = reader.read();
    // completely bypass \r's
    while(c == '\r') c = reader.read();
}
if (c < 0 || c == '\n')
    throw new LexerException("Unterminated regular expression: "+regexp);
c = reader.read();
// completely bypass \r's
while(c == '\r') c = reader.read();
  }

Regards

 

Last edit: Terrot Francois 2013-06-06