[Nice-commit] Nice/src/bossa/parser Parser.jj,1.321,1.322 JavaccParser.java,1.4,1.5
Brought to you by:
bonniot
From: Daniel B. <bo...@us...> - 2005-03-22 10:55:16
|
Update of /cvsroot/nice/Nice/src/bossa/parser In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1446/src/bossa/parser Modified Files: Parser.jj JavaccParser.java Log Message: Localize error message for unclosed comments. Index: Parser.jj =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/parser/Parser.jj,v retrieving revision 1.321 retrieving revision 1.322 diff -C2 -d -r1.321 -r1.322 *** Parser.jj 21 Mar 2005 16:55:35 -0000 1.321 --- Parser.jj 22 Mar 2005 10:55:06 -0000 1.322 *************** *** 93,103 **** /* COMMENTS */ ! TOKEN_MGR_DECLS : { int nestingLevel = 0; } MORE : { ! <"/**" ~["/"]> { input_stream.backup(1); } : IN_FORMAL_COMMENT | ! "/*" {nestingLevel++; }: IN_MULTI_LINE_COMMENT } --- 93,117 ---- /* COMMENTS */ ! TOKEN_MGR_DECLS : { int nestingLevel = 0; Location commentStart = null; } MORE : { ! <"/**" ~["/"]> ! { ! if (commentStart == null) ! commentStart = Location.make ! (input_stream.getBeginLine(), input_stream.getBeginColumn(), ! input_stream.getEndLine(), input_stream.getEndColumn()); ! input_stream.backup(1); ! } : IN_FORMAL_COMMENT | ! "/*" ! { ! if (commentStart == null) ! commentStart = Location.make ! (input_stream.getBeginLine(), input_stream.getBeginColumn(), ! input_stream.getEndLine(), input_stream.getEndColumn()); ! nestingLevel++; ! }: IN_MULTI_LINE_COMMENT } *************** *** 120,124 **** SKIP : { ! "*/" { if (--nestingLevel == 0) SwitchTo(DEFAULT); } } --- 134,138 ---- SKIP : { ! "*/" { if (--nestingLevel == 0) { commentStart = null; SwitchTo(DEFAULT); } } } Index: JavaccParser.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/parser/JavaccParser.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** JavaccParser.java 17 Jan 2005 13:16:56 -0000 1.4 --- JavaccParser.java 22 Mar 2005 10:55:06 -0000 1.5 *************** *** 76,83 **** String message = e.getMessage(); if (message.indexOf("<EOF>") != -1) ! message = "Unexpected end of file"; User.error(Location.nowhere(), message); } ! } finally { chrono.stop(); --- 76,86 ---- String message = e.getMessage(); if (message.indexOf("<EOF>") != -1) ! if (parser.token_source.commentStart != null) ! User.error(parser.token_source.commentStart, "Unclosed comment"); ! else ! message = "Unexpected end of file"; User.error(Location.nowhere(), message); } ! } finally { chrono.stop(); |