You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently a MultiMode lexer uses the "first" mode in the definition as the default mode.
So in this example the defaultMode will be "numbers_mode"
// old deprecated formatvarmultiModeLexerDefinition={// the default (initial) mode is "numbers_mode" it is implicitly defined as the first key in the definition object."numbers_mode": [One,Two,Three,ExitNumbers,EnterLetters,Whitespace],"Letter_mode": [Alpha,Beta,Gamma,ExitLetter,EnterSigns,Whitespace],"signs_mode": [Hash,Caret,Amp,ExitSigns,EnterNumbers,Whitespace]};
The problem is that the default mode relies on the order of iteration on javascript objects
which is left undefined in the ECMAScript specifications and is thus implementation dependent.
A more robust way would be to define the defaultMode explicitly:
// new formatvarmultiModeLexerDefinition={modes : {"numbers_mode": [One,Two,Three,ExitNumbers,EnterLetters,Whitespace],"Letter_mode": [Alpha,Beta,Gamma,ExitLetter,EnterSigns,Whitespace],"signs_mode": [Hash,Caret,Amp,ExitSigns,EnterNumbers,Whitespace]},// the default mode is explicitly defined.defaultMode : "numbers_mode"};
The text was updated successfully, but these errors were encountered:
Not that this is a breaking change which requires slight modification to existing MultiMode Lexers.
bd82
changed the title
MultiMode Lexer defaultMode should not be implicitly defined
MultiMode Lexer defaultMode should not be implicitly defined.
Jun 6, 2016
Currently a MultiMode lexer uses the "first" mode in the definition as the default mode.
So in this example the defaultMode will be "numbers_mode"
The problem is that the default mode relies on the order of iteration on javascript objects
which is left undefined in the ECMAScript specifications and is thus implementation dependent.
A more robust way would be to define the defaultMode explicitly:
The text was updated successfully, but these errors were encountered: