Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for #164 #166

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/expressir/express/parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ def keyword_rule(str)
end
rule(:procedureId) { simpleId.as(:procedureId) }
rule(:procedureRef) { procedureId.as(:procedureRef) }
rule(:qualifiableFactor) { (attributeRef | constantFactor | functionCall | generalRef | population).as(:qualifiableFactor) }
rule(:qualifiableFactor) { (functionCall | attributeRef | constantFactor | generalRef | population).as(:qualifiableFactor) }
rule(:qualifiedAttribute) { (tSELF >> groupQualifier >> attributeQualifier).as(:qualifiedAttribute) }
rule(:qualifier) { (attributeQualifier | groupQualifier | indexQualifier).as(:qualifier) }
rule(:queryExpression) do
Expand Down
24 changes: 15 additions & 9 deletions spec/syntax/remark.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -253,9 +253,11 @@ schemas:
remarks:
- function query scope - function query
aggregate_source:
_class: Expressir::Model::References::SimpleReference
id: remark_variable
base_path: remark_schema.remark_function.remark_variable
_class: Expressir::Model::Expressions::FunctionCall
function:
_class: Expressir::Model::References::SimpleReference
id: remark_variable
base_path: remark_schema.remark_function.remark_variable
expression:
_class: Expressir::Model::Literals::Logical
value: :TRUE
Expand Down Expand Up @@ -343,9 +345,11 @@ schemas:
remarks:
- rule query scope - rule query
aggregate_source:
_class: Expressir::Model::References::SimpleReference
id: remark_variable
base_path: remark_schema.remark_rule.remark_variable
_class: Expressir::Model::Expressions::FunctionCall
function:
_class: Expressir::Model::References::SimpleReference
id: remark_variable
base_path: remark_schema.remark_rule.remark_variable
expression:
_class: Expressir::Model::Literals::Logical
value: :TRUE
Expand Down Expand Up @@ -463,9 +467,11 @@ schemas:
remarks:
- procedure query scope - procedure query
aggregate_source:
_class: Expressir::Model::References::SimpleReference
id: remark_variable
base_path: remark_schema.remark_procedure.remark_variable
_class: Expressir::Model::Expressions::FunctionCall
function:
_class: Expressir::Model::References::SimpleReference
id: remark_variable
base_path: remark_schema.remark_procedure.remark_variable
expression:
_class: Expressir::Model::Literals::Logical
value: :TRUE
6 changes: 3 additions & 3 deletions spec/syntax/remark_formatted.exp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ FUNCTION remark_function(remark_parameter : STRING) : BOOLEAN;
;
--"remark_repeat" function repeat scope - function repeat
END_REPEAT;
remark_variable := QUERY(remark_query <* remark_variable | TRUE
remark_variable := QUERY(remark_query <* remark_variable() | TRUE
--"remark_query" function query scope - function query
);
END_FUNCTION;
Expand All @@ -66,7 +66,7 @@ RULE remark_rule FOR (remark_entity);
;
--"remark_repeat" rule repeat scope - rule repeat
END_REPEAT;
remark_variable := QUERY(remark_query <* remark_variable | TRUE
remark_variable := QUERY(remark_query <* remark_variable() | TRUE
--"remark_query" rule query scope - rule query
);
WHERE
Expand All @@ -91,7 +91,7 @@ PROCEDURE remark_procedure(remark_parameter : STRING);
;
--"remark_repeat" procedure repeat scope - procedure repeat
END_REPEAT;
remark_variable := QUERY(remark_query <* remark_variable | TRUE
remark_variable := QUERY(remark_query <* remark_variable() | TRUE
--"remark_query" procedure query scope - procedure query
);
END_PROCEDURE;
Expand Down
72 changes: 48 additions & 24 deletions spec/syntax/syntax.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1633,8 +1633,10 @@ schemas:
statements:
- _class: Expressir::Model::Statements::Case
expression:
_class: Expressir::Model::References::SimpleReference
id: test
_class: Expressir::Model::Expressions::FunctionCall
function:
_class: Expressir::Model::References::SimpleReference
id: test
actions:
- _class: Expressir::Model::Statements::CaseAction
labels:
Expand All @@ -1647,8 +1649,10 @@ schemas:
statements:
- _class: Expressir::Model::Statements::Case
expression:
_class: Expressir::Model::References::SimpleReference
id: test
_class: Expressir::Model::Expressions::FunctionCall
function:
_class: Expressir::Model::References::SimpleReference
id: test
actions:
- _class: Expressir::Model::Statements::CaseAction
labels:
Expand All @@ -1667,8 +1671,10 @@ schemas:
statements:
- _class: Expressir::Model::Statements::Case
expression:
_class: Expressir::Model::References::SimpleReference
id: test
_class: Expressir::Model::Expressions::FunctionCall
function:
_class: Expressir::Model::References::SimpleReference
id: test
actions:
- _class: Expressir::Model::Statements::CaseAction
labels:
Expand All @@ -1683,8 +1689,10 @@ schemas:
statements:
- _class: Expressir::Model::Statements::Case
expression:
_class: Expressir::Model::References::SimpleReference
id: test
_class: Expressir::Model::Expressions::FunctionCall
function:
_class: Expressir::Model::References::SimpleReference
id: test
actions:
- _class: Expressir::Model::Statements::CaseAction
labels:
Expand Down Expand Up @@ -3258,11 +3266,15 @@ schemas:
_class: Expressir::Model::Expressions::BinaryExpression
operator: :COMBINE
operand1:
_class: Expressir::Model::References::SimpleReference
id: test
_class: Expressir::Model::Expressions::FunctionCall
function:
_class: Expressir::Model::References::SimpleReference
id: test
operand2:
_class: Expressir::Model::References::SimpleReference
id: test2
_class: Expressir::Model::Expressions::FunctionCall
function:
_class: Expressir::Model::References::SimpleReference
id: test2
- _class: Expressir::Model::Declarations::Variable
id: in_expression
type:
Expand Down Expand Up @@ -3373,17 +3385,21 @@ schemas:
type:
_class: Expressir::Model::DataTypes::Boolean
expression:
_class: Expressir::Model::References::SimpleReference
id: test
_class: Expressir::Model::Expressions::FunctionCall
function:
_class: Expressir::Model::References::SimpleReference
id: test
- _class: Expressir::Model::Declarations::Variable
id: group_reference_expression
type:
_class: Expressir::Model::DataTypes::Boolean
expression:
_class: Expressir::Model::References::GroupReference
ref:
_class: Expressir::Model::References::SimpleReference
id: test
_class: Expressir::Model::Expressions::FunctionCall
function:
_class: Expressir::Model::References::SimpleReference
id: test
entity:
_class: Expressir::Model::References::SimpleReference
id: test2
Expand All @@ -3394,8 +3410,10 @@ schemas:
expression:
_class: Expressir::Model::References::IndexReference
ref:
_class: Expressir::Model::References::SimpleReference
id: test
_class: Expressir::Model::Expressions::FunctionCall
function:
_class: Expressir::Model::References::SimpleReference
id: test
index1:
_class: Expressir::Model::Literals::Integer
value: '1'
Expand All @@ -3406,8 +3424,10 @@ schemas:
expression:
_class: Expressir::Model::References::IndexReference
ref:
_class: Expressir::Model::References::SimpleReference
id: test
_class: Expressir::Model::Expressions::FunctionCall
function:
_class: Expressir::Model::References::SimpleReference
id: test
index1:
_class: Expressir::Model::Literals::Integer
value: '1'
Expand All @@ -3421,8 +3441,10 @@ schemas:
expression:
_class: Expressir::Model::References::AttributeReference
ref:
_class: Expressir::Model::References::SimpleReference
id: test
_class: Expressir::Model::Expressions::FunctionCall
function:
_class: Expressir::Model::References::SimpleReference
id: test
attribute:
_class: Expressir::Model::References::SimpleReference
id: test2
Expand Down Expand Up @@ -3502,8 +3524,10 @@ schemas:
_class: Expressir::Model::Expressions::QueryExpression
id: test
aggregate_source:
_class: Expressir::Model::References::SimpleReference
id: test2
_class: Expressir::Model::Expressions::FunctionCall
function:
_class: Expressir::Model::References::SimpleReference
id: test2
expression:
_class: Expressir::Model::Literals::Logical
value: :TRUE
22 changes: 11 additions & 11 deletions spec/syntax/syntax_formatted.exp
Original file line number Diff line number Diff line change
Expand Up @@ -560,27 +560,27 @@ PROCEDURE statements;
test.test2 := TRUE;
END_PROCEDURE;
PROCEDURE case_statement;
CASE test OF
CASE test() OF
TRUE :
;
END_CASE;
END_PROCEDURE;
PROCEDURE case_multiple_statement;
CASE test OF
CASE test() OF
TRUE :
;
TRUE :
;
END_CASE;
END_PROCEDURE;
PROCEDURE case_multiple_shorthand_statement;
CASE test OF
CASE test() OF
TRUE, TRUE :
;
END_CASE;
END_PROCEDURE;
PROCEDURE case_otherwise_statement;
CASE test OF
CASE test() OF
TRUE :
;
OTHERWISE :
Expand Down Expand Up @@ -878,24 +878,24 @@ PROCEDURE expressions;
and_or_expression : BOOLEAN := TRUE AND FALSE OR TRUE;
parenthesis_or_and_expression : BOOLEAN := (TRUE OR FALSE) AND TRUE;
and_parenthesis_or_expression : BOOLEAN := TRUE AND (FALSE OR TRUE);
combine_expression : BOOLEAN := test || test2;
combine_expression : BOOLEAN := test() || test2();
in_expression : BOOLEAN := TRUE IN [TRUE];
like_expression : BOOLEAN := 'xxx' LIKE 'xxx';
aggregate_initializer_expression : BOOLEAN := [4];
repeated_aggregate_initializer_expression : BOOLEAN := [4:2];
complex_aggregate_initializer_expression : BOOLEAN := [4 + 2];
complex_repeated_aggregate_initializer_expression : BOOLEAN := [4 + 2:4 + 2];
call_expression : BOOLEAN := parameter_function(TRUE);
simple_reference_expression : BOOLEAN := test;
group_reference_expression : BOOLEAN := test\test2;
index_reference_expression : BOOLEAN := test[1];
index2_reference_expression : BOOLEAN := test[1:9];
attribute_reference_expression : BOOLEAN := test.test2;
simple_reference_expression : BOOLEAN := test();
group_reference_expression : BOOLEAN := test()\test2;
index_reference_expression : BOOLEAN := test()[1];
index2_reference_expression : BOOLEAN := test()[1:9];
attribute_reference_expression : BOOLEAN := test().test2;
lt_lt_interval_expression : BOOLEAN := {1 < 5 < 9};
lte_lt_interval_expression : BOOLEAN := {1 <= 5 < 9};
lt_lte_interval_expression : BOOLEAN := {1 < 5 <= 9};
lte_lte_interval_expression : BOOLEAN := {1 <= 5 <= 9};
query_expression : BOOLEAN := QUERY(test <* test2 | TRUE);
query_expression : BOOLEAN := QUERY(test <* test2() | TRUE);
END_LOCAL;
END_PROCEDURE;

Expand Down
22 changes: 11 additions & 11 deletions spec/syntax/syntax_hyperlink_formatted.exp
Original file line number Diff line number Diff line change
Expand Up @@ -560,27 +560,27 @@ PROCEDURE statements;
test.test2 := TRUE;
END_PROCEDURE;
PROCEDURE case_statement;
CASE test OF
CASE test() OF
TRUE :
;
END_CASE;
END_PROCEDURE;
PROCEDURE case_multiple_statement;
CASE test OF
CASE test() OF
TRUE :
;
TRUE :
;
END_CASE;
END_PROCEDURE;
PROCEDURE case_multiple_shorthand_statement;
CASE test OF
CASE test() OF
TRUE, TRUE :
;
END_CASE;
END_PROCEDURE;
PROCEDURE case_otherwise_statement;
CASE test OF
CASE test() OF
TRUE :
;
OTHERWISE :
Expand Down Expand Up @@ -878,24 +878,24 @@ PROCEDURE expressions;
and_or_expression : BOOLEAN := TRUE AND FALSE OR TRUE;
parenthesis_or_and_expression : BOOLEAN := (TRUE OR FALSE) AND TRUE;
and_parenthesis_or_expression : BOOLEAN := TRUE AND (FALSE OR TRUE);
combine_expression : BOOLEAN := test || test2;
combine_expression : BOOLEAN := test() || test2();
in_expression : BOOLEAN := TRUE IN [TRUE];
like_expression : BOOLEAN := 'xxx' LIKE 'xxx';
aggregate_initializer_expression : BOOLEAN := [4];
repeated_aggregate_initializer_expression : BOOLEAN := [4:2];
complex_aggregate_initializer_expression : BOOLEAN := [4 + 2];
complex_repeated_aggregate_initializer_expression : BOOLEAN := [4 + 2:4 + 2];
call_expression : BOOLEAN := {{{<<express:syntax_schema.parameter_function,parameter_function>>}}}(TRUE);
simple_reference_expression : BOOLEAN := test;
group_reference_expression : BOOLEAN := test\test2;
index_reference_expression : BOOLEAN := test[1];
index2_reference_expression : BOOLEAN := test[1:9];
attribute_reference_expression : BOOLEAN := test.test2;
simple_reference_expression : BOOLEAN := test();
group_reference_expression : BOOLEAN := test()\test2;
index_reference_expression : BOOLEAN := test()[1];
index2_reference_expression : BOOLEAN := test()[1:9];
attribute_reference_expression : BOOLEAN := test().test2;
lt_lt_interval_expression : BOOLEAN := {1 < 5 < 9};
lte_lt_interval_expression : BOOLEAN := {1 <= 5 < 9};
lt_lte_interval_expression : BOOLEAN := {1 < 5 <= 9};
lte_lte_interval_expression : BOOLEAN := {1 <= 5 <= 9};
query_expression : BOOLEAN := QUERY(test <* test2 | TRUE);
query_expression : BOOLEAN := QUERY(test <* test2() | TRUE);
END_LOCAL;
END_PROCEDURE;

Expand Down