From 2f93795609f873a0212fe7d4880e143d686c5472 Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Fri, 20 Mar 2020 10:49:13 +0100 Subject: [PATCH] [plsql] remove BOM token, skip BOM in parser --- pmd-plsql/etc/grammar/PLSQL.jjt | 3 --- .../java/net/sourceforge/pmd/lang/plsql/ast/PLSQLParser.java | 5 +++++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/pmd-plsql/etc/grammar/PLSQL.jjt b/pmd-plsql/etc/grammar/PLSQL.jjt index 94d4f866ac..43e50b099c 100644 --- a/pmd-plsql/etc/grammar/PLSQL.jjt +++ b/pmd-plsql/etc/grammar/PLSQL.jjt @@ -227,8 +227,6 @@ PARSER_END(PLSQLParserImpl) */ ASTInput Input() : {} { - [] // Unicode BOM - // SRT 2011-04-17 This syntax breaks the parser when fields of record.attach* are referenced (attachLibrary())* ( (LOOKAHEAD(7) PackageSpecification() @@ -4505,7 +4503,6 @@ void AlterTrigger() : // Copyright (C) 2002 Albert Tumanov /* WHITE SPACE */ -TOKEN : { } SKIP : { diff --git a/pmd-plsql/src/main/java/net/sourceforge/pmd/lang/plsql/ast/PLSQLParser.java b/pmd-plsql/src/main/java/net/sourceforge/pmd/lang/plsql/ast/PLSQLParser.java index 6e83a30f40..41cf6859fb 100644 --- a/pmd-plsql/src/main/java/net/sourceforge/pmd/lang/plsql/ast/PLSQLParser.java +++ b/pmd-plsql/src/main/java/net/sourceforge/pmd/lang/plsql/ast/PLSQLParser.java @@ -30,6 +30,11 @@ public class PLSQLParser extends JjtreeParserAdapter { return new JavaccTokenDocument(fullText); } + @Override + public ASTInput parse(String fileName, Reader source) throws ParseException { + return super.parse(fileName, IOUtil.skipBOM(source)); + } + @Override protected ASTInput parseImpl(CharStream cs, ParserOptions options) throws ParseException { return new PLSQLParserImpl(cs).Input();