grammatica-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Grammatica-users] tokinze and parse results


From: Steffen Gaede
Subject: [Grammatica-users] tokinze and parse results
Date: Wed, 28 Mar 2012 11:41:00 +0200
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:11.0) Gecko/20120312 Thunderbird/11.0

What is the difference between both results, if I've the same input,
same grammar - but the parser fails, should the tokenizer not fails, too?

if I have following stupid example:
SELECT *
FROM room_price R1, Accommodation A1
WHERE
        (R1.regular_price > 8) or ((R1.regular_price > 8) and (R1.regular_price
> 8))


the parser fails with "((R1.regular_price" but not with "((regular_price "

the tokenizer has no errors.


The grammar is attached.

--------------------------------
Tokinzier output:

Tokens from ../my/sfwtest10b.txt:
selectToken(1012): "SELECT", line: 1, col: 1
ASTERISK(1043): "*", line: 1, col: 8
fromToken(1013): "FROM", line: 2, col: 1
ID(1048): "room_price", line: 2, col: 6
ID(1048): "R1", line: 2, col: 17
KOMMA(1034): ",", line: 2, col: 19
ID(1048): "Accommodation", line: 2, col: 21
ID(1048): "A1", line: 2, col: 35
whereToken(1014): "WHERE", line: 3, col: 1
LEFT_PAREN(1032): "(", line: 4, col: 3
ID(1048): "R1", line: 4, col: 4
DOT(1042): ".", line: 4, col: 6
ID(1048): "regular_price", line: 4, col: 7
GREATER(1038): ">", line: 4, col: 21
NUMBER(1047): "8", line: 4, col: 23
RIGHT_PAREN(1033): ")", line: 4, col: 24
OR(1009): "or", line: 4, col: 26
LEFT_PAREN(1032): "(", line: 4, col: 29
LEFT_PAREN(1032): "(", line: 4, col: 30
ID(1048): "R1", line: 4, col: 31
DOT(1042): ".", line: 4, col: 33
ID(1048): "regular_price", line: 4, col: 34
GREATER(1038): ">", line: 4, col: 48
NUMBER(1047): "8", line: 4, col: 50
RIGHT_PAREN(1033): ")", line: 4, col: 51
AND(1008): "and", line: 4, col: 53
LEFT_PAREN(1032): "(", line: 4, col: 57
ID(1048): "R1", line: 4, col: 58
DOT(1042): ".", line: 4, col: 60
ID(1048): "regular_price", line: 4, col: 61
GREATER(1038): ">", line: 4, col: 75
NUMBER(1047): "8", line: 4, col: 77
RIGHT_PAREN(1033): ")", line: 4, col: 78
RIGHT_PAREN(1033): ")", line: 4, col: 79

--------------------------------
Parser output (cutout)

    WT(2011)
      whereToken(1014): "WHERE", line: 3, col: 1
      W1(2012)
        LEFT_PAREN(1032): "(", line: 4, col: 3
        W1(2012)
          W3W2(2013)
            W3(2015)
              Reference(2025)
                ID(1048): "R1", line: 4, col: 4
                DOT(1042): ".", line: 4, col: 6
                ID(1048): "regular_price", line: 4, col: 7
            W2(2014)
              COMP1(2029)
                GREATER(1038): ">", line: 4, col: 21
              W3(2015)
                NUMBER(1047): "8", line: 4, col: 23
        RIGHT_PAREN(1033): ")", line: 4, col: 24
        COMP2(2030)
          OR(1009): "or", line: 4, col: 26
        W1(2012)
Error: in ../my/sfwtest10b.txt: line 4:
    unexpected token ".", expected one of "and", "or", ")", "=", "!=",
    ">=", ">", "<=", "<", "<>", "like", "between", "not", or "in"

                (R1.regular_price > 8) or ((R1.regular_price > 8) and
(R1.regular_price > 8))
                                              ^
Error: in ../my/sfwtest10b.txt: line 4:
    unexpected token ")", expected <EOF>

                (R1.regular_price > 8) or ((R1.regular_price > 8) and
(R1.regular_price > 8))
--------------------------------

Steffen.

Attachment: sfw.grammar
Description: Text document


reply via email to

[Prev in Thread] Current Thread [Next in Thread]