You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
so, whenever in my testfile "e" or "ou" were found they should return "AND" and "OR" respectively.
The problem is, when i test it, instead of returning me "AND" and "OR" it is returning me "e" and "ou".
Take a look:
This is my testfile:
test.sgr
Listar Contratos
Onde C.preco=1000
Retornar C.Preco, C.NifAdjudicante,C.NifAdjudicataria;
Listar Contratos
Onde C.preco=1000 e E1.name="ESTG"
Retornar C.Preco, C.NifAdjudicante,C.NifAdjudicataria;
Listar Contratos
Onde C.preco=1000 e E1.name="ESTG" e C.TipoProcedimento="ADS"
Retornar C.Preco, C.NifAdjudicante,C.NifAdjudicataria;
Listar Contratos
Onde E1.name="ESTG"
Retornar E1.name,C.Preco,C.NifAdjudicante,C.NifAdjudicataria;
Listar Contratos
Onde E1.name="ESTG" e C.preco=1000 ou C.preco>1000
Retornar E1.name,C.Preco,C.NifAdjudicante,C.NifAdjudicataria;
The outputs should be:
MATCH (E1:ENTIDADE)-[C:CONTRATO] -> (E2:ENTIDADE)
WHERE C.preco = 1000
RETURN C.Preco, C.NifAdjudicante, C.NifAdjudicataria
MATCH (E1:ENTIDADE)-[C:CONTRATO] -> (E2:ENTIDADE)
WHERE C.preco = 1000 AND E1.name = " ESTG "
RETURN C.Preco, C.NifAdjudicante, C.NifAdjudicataria
MATCH (E1:ENTIDADE)-[C:CONTRATO] -> (E2:ENTIDADE)
WHERE C.preco = 1000 AND E1.name = " ESTG " AND C.TipoProcedimento = " ADS "
RETURN C.Preco, C.NifAdjudicante, C.NifAdjudicataria
MATCH (E1:ENTIDADE)-[C:CONTRATO] -> (E2:ENTIDADE)
WHERE E1.name = " ESTG "
RETURN E1.name, C.Preco, C.NifAdjudicante, C.NifAdjudicataria
MATCH (E1:ENTIDADE)-[C:CONTRATO] -> (E2:ENTIDADE)
WHERE E1.name = " ESTG " AND C.preco = 1000 OR C.preco > 1000
RETURN E1.name, C.Preco, C.NifAdjudicante, C.NifAdjudicataria
However the outputs are:
What i've done wrong?
The text was updated successfully, but these errors were encountered:
For the AND and OR tokens in your grammar rules, your rules' action code takes their value (condition rule: $$ = ... + $2 + ...; where $2 references the AND (or OR) token in that subrule. The value for the lexed token is its lexed string ('e' or 'ou' in your case) unless you specifically set it to something else.
Two ways about it (not tested; YMMV as this should work for the jison-gho fork at least, but not sure about jison itself):
1:
$$ = ... + 'AND' + ...; i.e. hardcoding the AND and OR strings in the grammar rules' action blocks.
2:
augment the lexer to return different token values (which will then be used by the $2 references):
e yytext = "AND";
return 'AND'
ou yytext = "OR";
return 'OR'
Second approach is cleaner IMO (and more akin to what you'ld do when doing this in classic lex / flex)
I'm creating a grammar in jison
This is my jison file:
In my lexical grammar definition i have:
so, whenever in my testfile "e" or "ou" were found they should return "AND" and "OR" respectively.
The problem is, when i test it, instead of returning me "AND" and "OR" it is returning me "e" and "ou".
Take a look:
This is my testfile:
The outputs should be:
However the outputs are:
What i've done wrong?
The text was updated successfully, but these errors were encountered: