uw-pluverse / perses

language-agnostic program reducer.
GNU General Public License v3.0
168 stars 24 forks source link

msg: no viable alternative at input 'VALUES (0Xffffffffe7e53170', for SQLite file #28

Open mzfr opened 9 months ago

mzfr commented 9 months ago

This issue is very similar to #23, it just in my scenario I was trying to use perses on a sqlite file.

[17:44:32] [INFO   ] Tree Building: Start building spar-tree from input file SourceFile{file=FileWithContent{file=logs/database7-cur.sqlite}, lang=LanguageSQLite{name=sqlite, extensions=[sqlite], defaultCodeFormatControl=SINGLE_TOKEN_PER_LINE}}
[17:44:32] [INFO   ] Tree Building: Step 1: Antlr parsing.
Exception in thread "main" org.perses.grammar.AntlrFailureException: Error in parsing file: <in memory>
Details: recognizer: org.perses.grammar.sql.sqlite.PnfSQLiteParser@9dada78
offendingSymbol: [@84,352:368='Xffffffffe7e53170',<184>,10:35]
line: 10
column: 35
msg: no viable alternative at input 'VALUES (0Xffffffffe7e53170'

        at org.perses.grammar.FailOnErrorAntlrErrorListener.syntaxError(FailOnErrorAntlrErrorListener.kt:43)
        at org.antlr.v4.runtime.ProxyErrorListener.syntaxError(ProxyErrorListener.java:41)
        at org.antlr.v4.runtime.Parser.notifyErrorListeners(Parser.java:544)
        at org.antlr.v4.runtime.DefaultErrorStrategy.reportNoViableAlternative(DefaultErrorStrategy.java:310)
        at org.antlr.v4.runtime.DefaultErrorStrategy.reportError(DefaultErrorStrategy.java:136)
        at org.perses.grammar.sql.sqlite.PnfSQLiteParser.altnt_block__insert_stmt_18(PnfSQLiteParser.java:14205)
        at org.perses.grammar.sql.sqlite.PnfSQLiteParser.aux_rule__insert_stmt_22(PnfSQLiteParser.java:15717)
        at org.perses.grammar.sql.sqlite.PnfSQLiteParser.insert_stmt(PnfSQLiteParser.java:2019)
        at org.perses.grammar.sql.sqlite.PnfSQLiteParser.altnt_block__sql_stmt_5(PnfSQLiteParser.java:13497)
        at org.perses.grammar.sql.sqlite.PnfSQLiteParser.sql_stmt(PnfSQLiteParser.java:549)
        at org.perses.grammar.sql.sqlite.PnfSQLiteParser.sql_stmt_list(PnfSQLiteParser.java:508)
        at org.perses.grammar.sql.sqlite.PnfSQLiteParser.kleene_star__parse_1(PnfSQLiteParser.java:3621)
        at org.perses.grammar.sql.sqlite.PnfSQLiteParser.parse(PnfSQLiteParser.java:463)
        at org.perses.grammar.sql.sqlite.SQLiteParserFacade.startParsing(SQLiteParserFacade.java:39)
        at org.perses.grammar.sql.sqlite.SQLiteParserFacade.startParsing(SQLiteParserFacade.java:13)
        at org.perses.grammar.AbstractDefaultParserFacade$parseReader$3.apply(AbstractDefaultParserFacade.kt:70)
        at org.perses.grammar.AbstractDefaultParserFacade$parseReader$3.apply(AbstractDefaultParserFacade.kt:65)
        at org.perses.grammar.AbstractDefaultParserFacade$Companion.parseReader(AbstractDefaultParserFacade.kt:151)
        at org.perses.grammar.AbstractDefaultParserFacade.parseReader(AbstractDefaultParserFacade.kt:65)
        at org.perses.grammar.AbstractParserFacade.parseString(AbstractParserFacade.kt:97)
        at org.perses.grammar.AbstractParserFacade.parseString$default(AbstractParserFacade.kt:95)
        at org.perses.reduction.AbstractProgramReductionDriver$Companion.createSparTree(AbstractProgramReductionDriver.kt:640)
        at org.perses.reduction.RegularProgramReductionDriver$Companion.create(RegularProgramReductionDriver.kt:121)
        at org.perses.Main.createReductionDriver(Main.kt:64)
        at org.perses.AbstractMain.internalRun(AbstractMain.kt:41)
        at org.perses.util.cmd.AbstractMain.run(AbstractMain.kt:53)
        at org.perses.Main$Companion.main(Main.kt:70)
        at org.perses.Main.main(Main.kt)
Caused by: org.antlr.v4.runtime.NoViableAltException
        at org.antlr.v4.runtime.atn.ParserATNSimulator.noViableAlt(ParserATNSimulator.java:2014)
        at org.antlr.v4.runtime.atn.ParserATNSimulator.execATN(ParserATNSimulator.java:445)
        at org.antlr.v4.runtime.atn.ParserATNSimulator.adaptivePredict(ParserATNSimulator.java:371)
        at org.perses.grammar.sql.sqlite.PnfSQLiteParser.altnt_block__insert_stmt_18(PnfSQLiteParser.java:14186)
        ... 22 more

The test script I was using has the following content:

#!/bin/sh

sqlite3.27 < database7-cur.sqlite

if [ $? -eq 139 ]; then
    exit 0
else
    exit 1
fi

The database7-cur.sqlite.txt is a 145K in size and has the following md5sum: 690c32477d12119a0d62c464adc8f20a

database7-cur.sqlite.txt

chengniansun commented 9 months ago

Thank you for the detailed bug report. We will look into how to fix this these days.