Skip to content

Commit

Permalink
Fix for antlr#4306
Browse files Browse the repository at this point in the history
  • Loading branch information
kaby76 committed Nov 3, 2024
1 parent 93e0d24 commit b3c7025
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions sql/postgresql/CSharp/PostgreSQLParserBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -120,4 +120,12 @@ public PostgreSQLParser getPostgreSQLParser(string script)
parser.AddErrorListener(listener_parser);
return parser;
}

// Make sure to only allow these as unary, postfix operators.
public bool OnlyAcceptableOps()
{
var c = ((CommonTokenStream)this.InputStream).LT(1);
var text = c.Text;
return text == "!" || text == "!!";
}
}
2 changes: 1 addition & 1 deletion sql/postgresql/PostgreSQLParser.g4
Original file line number Diff line number Diff line change
Expand Up @@ -3545,7 +3545,7 @@ a_expr
/*19*/

a_expr_qual
: a_expr_lessless qual_op?
: a_expr_lessless ({ this.OnlyAcceptableOps() }? qual_op | )
;

/*18*/
Expand Down

0 comments on commit b3c7025

Please sign in to comment.