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

What are the "SLL mode failed" Warnings? #3094

Closed
SystemsModelling opened this issue Jun 30, 2017 · 3 comments
Closed

What are the "SLL mode failed" Warnings? #3094

SystemsModelling opened this issue Jun 30, 2017 · 3 comments
Labels
antlr Issue is easier to resolve with knowledge of Antlr4 support Whether you're using Rubberduck or you've forked it and have questions, never hesitate to ask!

Comments

@SystemsModelling
Copy link

SystemsModelling commented Jun 30, 2017

Things like these. It ends up in Ready all right, but what are the warnings about?

2017-06-30 09:52:32.5399;DEBUG-2.0.13.32288;Rubberduck.Parsing.Symbols.SyntaxErrorException;;
2017-06-30 09:52:32.5399;DEBUG-2.0.13.32288;Rubberduck.Parsing.Symbols.SyntaxErrorException;Token: End Sub (L64C1);
2017-06-30 09:52:32.5529;DEBUG-2.0.13.32288;Rubberduck.Parsing.VBA.RubberduckParserState;Module 'clsDebug' state is changing to 'Parsed' (thread 19);
2017-06-30 09:52:32.5529;WARN-2.0.13.32288;Rubberduck.Parsing.VBA.VBAModuleParser;SLL mode failed in module ThisWorkbook. Retrying using LL.;Rubberduck.Parsing.Symbols.SyntaxErrorException: extraneous input 'End Sub' expecting {ABS, ANY, ARRAY, B_CHAR, BF, CBOOL, CBYTE, CCUR, CDATE, CDBL, CDEC, CINT, CIRCLE, CLNG, CLNGLNG, CLNGPTR, CSNG, CSTR, CURRENCY, CVAR, CVERR, DEBUG, DOEVENTS, EXIT, FIX, INPUTB, INT, LBOUND, LEN, LENB, LONGLONG, LONGPTR, MIDB, MIDBTYPESUFFIX, MIDTYPESUFFIX, OPTION, PSET, SCALE, SGN, UBOUND, ':', '!', '.', '#', ACCESS, ADDRESSOF, ALIAS, AND, ATTRIBUTE, APPEND, AS, BEGIN, BINARY, BOOLEAN, BYVAL, BYREF, BYTE, CALL, CASE, CLASS, CLOSE, CONST, DATABASE, DATE, DECLARE, DEFBOOL, DEFBYTE, DEFDATE, DEFDBL, DEFCUR, DEFINT, DEFLNG, DEFLNGLNG, DEFLNGPTR, DEFOBJ, DEFSNG, DEFSTR, DEFVAR, DIM, DO, DOUBLE, ELSE, ELSEIF, EMPTY, END_IF, END_SELECT, END_WITH, END, ENUM, EQV, ERASE, ERROR, EVENT, EXIT_DO, EXIT_FOR, EXIT_FUNCTION, EXIT_PROPERTY, EXIT_SUB, FALSE, FRIEND, FOR, FUNCTION, GET, GLOBAL, GOSUB, GOTO, IF, IMP, IMPLEMENTS, IN, INPUT, IS, INTEGER, LOCK, LONG, LOOP, LET, LIB, LIKE, LINE_INPUT, LOCK_READ, LOCK_WRITE, LOCK_READ_WRITE, LSET, ME, MID, MOD, NAME, NEXT, NEW, NOT, NOTHING, NULL, OBJECT, ON, ON_ERROR, ON_LOCAL_ERROR, OPEN, OPTIONAL, OR, OUTPUT, PARAMARRAY, PRESERVE, PRINT, PRIVATE, PTRSAFE, PUBLIC, PUT, RANDOM, RAISEEVENT, READ, READ_WRITE, REDIM, REM, RESET, RESUME, RETURN, RSET, SEEK, SELECT, SET, SHARED, SINGLE, SPC, STATIC, STEP, STOP, STRING, SUB, TAB, TEXT, THEN, TO, TRUE, TYPE, TYPEOF, UNLOCK, UNTIL, VARIANT, VERSION, WEND, WHILE, WIDTH, WITH, WITHEVENTS, WRITE, XOR, '(', '-', '[', STRINGLITERAL, OCTLITERAL, HEXLITERAL, FLOATLITERAL, INTEGERLITERAL, DATELITERAL, NEWLINE, ''', WS, IDENTIFIER, LINE_CONTINUATION, LOAD, RESUME_NEXT}
   at Rubberduck.Parsing.Symbols.ExceptionErrorListener.SyntaxError(IRecognizer recognizer, IToken offendingSymbol, Int32 line, Int32 charPositionInLine, String msg, RecognitionException e) in C:\Users\Mathieu\Documents\GitHub\Rubberduck (main)\Rubberduck\Rubberduck.Parsing\Symbols\ExceptionErrorListener.cs:line 10
   at Antlr4.Runtime.ProxyErrorListener`1.SyntaxError(IRecognizer recognizer, Symbol offendingSymbol, Int32 line, Int32 charPositionInLine, String msg, RecognitionException e)
   at Antlr4.Runtime.Parser.NotifyErrorListeners(IToken offendingToken, String msg, RecognitionException e)
   at Antlr4.Runtime.DefaultErrorStrategy.ReportUnwantedToken(Parser recognizer)
   at Antlr4.Runtime.DefaultErrorStrategy.Sync(Parser recognizer)
   at Rubberduck.Parsing.Grammar.VBAParser.endOfStatement() in C:\Users\Mathieu\Documents\GitHub\Rubberduck (main)\Rubberduck\Rubberduck.Parsing\Grammar\VBAParser.cs:line 18768
   at Rubberduck.Parsing.Grammar.VBAParser.block() in C:\Users\Mathieu\Documents\GitHub\Rubberduck (main)\Rubberduck\Rubberduck.Parsing\Grammar\VBAParser.cs:line 1542
   at Rubberduck.Parsing.Grammar.VBAParser.ifStmt() in C:\Users\Mathieu\Documents\GitHub\Rubberduck (main)\Rubberduck\Rubberduck.Parsing\Grammar\VBAParser.cs:line 7695
   at Rubberduck.Parsing.Grammar.VBAParser.blockStmt() in C:\Users\Mathieu\Documents\GitHub\Rubberduck (main)\Rubberduck\Rubberduck.Parsing\Grammar\VBAParser.cs:line 1796
   at Rubberduck.Parsing.Grammar.VBAParser.block() in C:\Users\Mathieu\Documents\GitHub\Rubberduck (main)\Rubberduck\Rubberduck.Parsing\Grammar\VBAParser.cs:line 1541
   at Rubberduck.Parsing.Grammar.VBAParser.subStmt() in C:\Users\Mathieu\Documents\GitHub\Rubberduck (main)\Rubberduck\Rubberduck.Parsing\Grammar\VBAParser.cs:line 11301
   at Rubberduck.Parsing.Grammar.VBAParser.moduleBodyElement() in C:\Users\Mathieu\Documents\GitHub\Rubberduck (main)\Rubberduck\Rubberduck.Parsing\Grammar\VBAParser.cs:line 1477
   at Rubberduck.Parsing.Grammar.VBAParser.moduleBody() in C:\Users\Mathieu\Documents\GitHub\Rubberduck (main)\Rubberduck\Rubberduck.Parsing\Grammar\VBAParser.cs:line 1381
   at Rubberduck.Parsing.Grammar.VBAParser.module() in C:\Users\Mathieu\Documents\GitHub\Rubberduck (main)\Rubberduck\Rubberduck.Parsing\Grammar\VBAParser.cs:line 358
   at Rubberduck.Parsing.Grammar.VBAParser.startRule() in C:\Users\Mathieu\Documents\GitHub\Rubberduck (main)\Rubberduck\Rubberduck.Parsing\Grammar\VBAParser.cs:line 268
   at Rubberduck.Parsing.VBA.VBAModuleParser.Parse(String moduleName, String moduleCode, IParseTreeListener[] listeners, BaseErrorListener errorListener, ITokenStream& outStream) in C:\Users\Mathieu\Documents\GitHub\Rubberduck (main)\Rubberduck\Rubberduck.Parsing\VBA\VBAModuleParser.cs:line 25
2017-06-30 09:52:32.5889;TRACE-2.0.13.32288;Rubberduck.Parsing.VBA.ComponentParseTask;Starting ParseTaskID bb7d8a1e-93e4-4984-b045-318ae27e6cb6 on thread 19.;
@Vogel612 Vogel612 added antlr Issue is easier to resolve with knowledge of Antlr4 support Whether you're using Rubberduck or you've forked it and have questions, never hesitate to ask! labels Jun 30, 2017
@Vogel612
Copy link
Member

The way I understood it, ANTLR (our friend and helper for parsing your VBA code) has different "modes" of how it attempts to understand the code you feed it.

These modes are the SLL mode and the LL mode. They work a bit differently internally, which means that the SLL mode is generally speaking faster, if it works, but sometimes fails on valid input. Opposed to that, the LL mode is slower, but it will only fail, if things are actually broken.

To leverage the speed of SLL and the correctness of LL the best possible, Rubberduck first attempts to parse modules you give it with the SLL mode. If that fails, we can't guarantee there is an actual syntax error. Accordingly Rubberduck retries parsing the module in LL mode.
If that works, we're good. If it doesn't, there's a parser error.

Since the generated ParseTrees are the same, everything after that step is unaffected by whether the code was parsed in SLL or LL mode. In general the SLL mode will work in most cases, and then we get a good speedup out of it. If it doesn't work, we have to suck up the speed penalty of LL mode.

@rubberduck203
Copy link
Member

@bclothier
Copy link
Contributor

Closing this issue as the question has been answered.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
antlr Issue is easier to resolve with knowledge of Antlr4 support Whether you're using Rubberduck or you've forked it and have questions, never hesitate to ask!
Projects
None yet
Development

No branches or pull requests

4 participants