예제 #1
0
        //Covers simple identifiers like abcd, and also quoted versions: [abc d], "abc d".
        public static IdentifierTerminal CreateSqlExtIdentifier(Grammar grammar, string name)
        {
            var id   = new IdentifierTerminal(name);
            var term = new StringLiteral(name + "_qouted");

            term.AddStartEnd("[", "]", StringOptions.NoEscapes);
            term.AddStartEnd("\"", StringOptions.NoEscapes);
            term.SetOutputTerminal(grammar, id); //term will be added to NonGrammarTerminals automatically
            return(id);
        }
예제 #2
0
        public static StringLiteral CreatePythonString(string name)
        {
            StringLiteral term = new StringLiteral(name);

            term.AddStartEnd("'", StringOptions.AllowsAllEscapes);
            term.AddStartEnd("'''", StringOptions.AllowsAllEscapes | StringOptions.AllowsLineBreak);
            term.AddStartEnd("\"", StringOptions.AllowsAllEscapes);
            term.AddStartEnd("\"\"\"", StringOptions.AllowsAllEscapes | StringOptions.AllowsLineBreak);

            term.AddPrefix("u", StringOptions.AllowsAllEscapes);
            term.AddPrefix("r", StringOptions.NoEscapes);
            term.AddPrefix("ur", StringOptions.NoEscapes);

            return(term);
        }
예제 #3
0
        public static StringLiteral CreateVbString(string name)
        {
            StringLiteral term = new StringLiteral(name);

            term.AddStartEnd("\"", StringOptions.NoEscapes | StringOptions.AllowsDoubledQuote);
            term.AddSuffix("$", TypeCode.String);
            term.AddSuffix("c", TypeCode.Char);
            return(term);
        }