diff options
author | Miguel de Icaza <miguel@gnome.org> | 2008-08-27 02:01:41 +0400 |
---|---|---|
committer | Miguel de Icaza <miguel@gnome.org> | 2008-08-27 02:01:41 +0400 |
commit | 006325936fcc005173d11f89f42687d644446838 (patch) | |
tree | eda71b3abe77aebd623d29bcbe43b81f6d2c5355 /mcs/jay | |
parent | cc1da8945a7ddd10a612f94ac4297450915c62d6 (diff) |
Improve JAY: now we support EOF detection
svn path=/trunk/mcs/; revision=111664
Diffstat (limited to 'mcs/jay')
-rw-r--r-- | mcs/jay/skeleton.cs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/mcs/jay/skeleton.cs b/mcs/jay/skeleton.cs index 8584cb24a18..603a9dedc9c 100644 --- a/mcs/jay/skeleton.cs +++ b/mcs/jay/skeleton.cs @@ -23,6 +23,9 @@ . yyerror(message, null); . } . +. /* An EOF token */ +. public int eof_token; +. . /** (syntax) error message. . Can be overwritten to control message format. . @param message text to be displayed. @@ -173,6 +176,7 @@ t debug.shift(yyState, yyTable[yyN], yyErrorFlag-1); . case 0: . // yyerror(String.Format ("syntax error, got token `{0}'", yyname (yyToken)), yyExpecting(yyState)); t if (debug != null) debug.error("syntax error"); +. if (yyToken == 0 || yyToken == eof_token /* eof */) throw new yyParser.yyUnexpectedEof (); . goto case 1; . case 1: case 2: . yyErrorFlag = 3; @@ -332,6 +336,12 @@ t if (debug != null) debug.shift(yyStates[yyTop], yyState); . public yyException (string message) : base (message) { . } . } +. internal class yyUnexpectedEof : yyException { +. public yyUnexpectedEof (string message) : base (message) { +. } +. public yyUnexpectedEof () : base ("") { +. } +. } . . /** must be implemented by a scanner object to supply input to the parser. . */ |