problem with double quote string

Mar 18, 2013 at 4:12 AM
Edited Mar 18, 2013 at 6:57 AM
Hi, I just learn to use irony. My grammar is modified from SQL sample as follows:
            var string_literal = new StringLiteral("string", "\"", StringOptions.AllowsDoubledQuote);
            var Id_simple = TerminalFactory.CreateSqlExtIdentifier(this, "id_simple");
            var GOTO = ToTerm("GOTO");

            var stmt_Goto = new NonTerminal("stmt_Goto");

            var def_addr = new NonTerminal("def_address");
            var stmt = new NonTerminal("stmt");
            var stmtLine = new NonTerminal("stmtLine");
            var semicolon = new NonTerminal("semicolon");
            var stmtList = new NonTerminal("stmtList");

            //BNF Rules
            this.Root = stmtList;

            stmtList.Rule = MakePlusRule(stmtList, stmtLine);
            stmtLine.Rule = stmt + semicolon;
            semicolon.Rule = ";";

            stmt.Rule = stmt_Goto;

            stmt_Goto.Rule = GOTO + def_addr;
            def_addr.Rule = string_literal;
The problem is when I tried to parse the source, eg
goto "somewhere";
It returned error message: "Syntax Error, expected: string". If I change the string literal to single quote, it works. How to use double quote in string literal? Thanks
Mar 18, 2013 at 4:31 AM
Edited Mar 18, 2013 at 4:32 AM
where's def_addr.Rule assigned?
Mar 18, 2013 at 6:58 AM
ahhh sorry, I accidentally deleted the line... I have edit my post above. Thanks.
Mar 21, 2013 at 3:46 AM
your problem is that string literal is ambiguous: CreateSqlExtIdentifier creates an Id that allows (according to SQL standard) identifiers enclosed in square brackets or in double quotes. So "somewhere" is parsed as Sql identifier, not as string_literal.
Mar 21, 2013 at 8:42 AM
solved ! I replace it with csharpidentifier. thanks...