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

ASBITSTREAM - additive expression as value of parameter #105

Closed
SergeyPugachyov opened this issue Dec 7, 2018 · 0 comments
Closed

ASBITSTREAM - additive expression as value of parameter #105

SergeyPugachyov opened this issue Dec 7, 2018 · 0 comments

Comments

@SergeyPugachyov
Copy link
Contributor

The code is:

DECLARE IN_STR_BLOB BLOB ASBITSTREAM(IN_STR_ROW.IN_STR CCSID 1208 SET MESSAGESET TYPE functionName || '_IN' FORMAT 'Str');

The test ParsingErrorCheck failed because of concatination ||. To fix it you can modify method in the file esql-frontend\src\main\java\com\exxeta\iss\sonar\esql\parser\EsqlGrammar.java:

	public AsbitstreamFunctionTreeImpl ASBITSTREAM_FUNCTION() {
		return b.<AsbitstreamFunctionTreeImpl>nonterminal(Kind.ASBITSTREAM_FUNCTION).is(f.asbitstreamFunction(
				b.token(EsqlNonReservedKeyword.ASBITSTREAM), b.token(EsqlPunctuator.LPARENTHESIS),
				FIELD_REFERENCE(),b.optional(b.firstOf( 
					b.oneOrMore(f.newTuple106(b.token(EsqlPunctuator.COMMA), b.optional(CALL_EXPRESSION()))),
					b.oneOrMore(f.newTuple107(b.firstOf(
						b.token(EsqlNonReservedKeyword.OPTIONS), 
						b.token(EsqlNonReservedKeyword.ENCODING), 
						b.token(EsqlNonReservedKeyword.CCSID), 
						b.token(EsqlNonReservedKeyword.SET), 
						b.token(EsqlNonReservedKeyword.TYPE), 
						b.token(EsqlNonReservedKeyword.FORMAT)
					), b.optional(CALL_EXPRESSION())))
					  )),
				b.token(EsqlPunctuator.RPARENTHESIS)
				
		));
	}

To this (very important to set ADDITIVE_EXPRESSION() on the first place):

	public AsbitstreamFunctionTreeImpl ASBITSTREAM_FUNCTION() {
		return b.<AsbitstreamFunctionTreeImpl>nonterminal(Kind.ASBITSTREAM_FUNCTION).is(f.asbitstreamFunction(
				b.token(EsqlNonReservedKeyword.ASBITSTREAM), b.token(EsqlPunctuator.LPARENTHESIS),
				FIELD_REFERENCE(),b.optional(b.firstOf(
					b.oneOrMore(f.newTuple106(b.token(EsqlPunctuator.COMMA), b.optional(CALL_EXPRESSION()))),
					b.oneOrMore(f.newTuple107(b.firstOf(
						b.token(EsqlNonReservedKeyword.OPTIONS),
						b.token(EsqlNonReservedKeyword.ENCODING),
						b.token(EsqlNonReservedKeyword.CCSID),
						b.token(EsqlNonReservedKeyword.SET),
						b.token(EsqlNonReservedKeyword.TYPE),
						b.token(EsqlNonReservedKeyword.FORMAT)
					), b.optional(b.firstOf(ADDITIVE_EXPRESSION(), CALL_EXPRESSION()))))
					  )),
				b.token(EsqlPunctuator.RPARENTHESIS)
				
		));
	}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants