-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
added some properties and methods #4525
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,13 +16,16 @@ export declare class Lexer extends Recognizer<number> { | |
_tokenStartLine: number; | ||
_tokenStartColumn: number; | ||
_type: number; | ||
_modeStack: number[]; | ||
_mode: number; | ||
|
||
constructor(input: CharStream); | ||
reset(): void; | ||
nextToken(): Token; | ||
skip(): void; | ||
more(): void; | ||
more(m: number): void; | ||
mode(m: number): void; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess the intent with the 2nd There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The 2 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There should only be 1, it's a bug in the existing file. |
||
pushMode(m: number): void; | ||
popMode(): number; | ||
emitToken(token: Token): void; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,4 +6,6 @@ export declare class Recognizer<TSymbol> { | |
|
||
removeErrorListeners(): void; | ||
addErrorListener(listener: ErrorListener<TSymbol>): void; | ||
getSymbolicNames(): string[]; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe also add There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would add all JavaScript attributes, but you wrote: "I only export what is strictly required" There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe in encapsulation. I'm ok to provide data via methods, not so much direct read/write access to fields that may change anytime... Adding |
||
getErrorListenerDispatch(): ErrorListener<TSymbol>; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we rename this to say There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The name I don't like the name There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually we can't change that name without breaking backwards compatibility in JS... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Indeed, unfortunately the I remove my setMode method because there is already a mode method that does the same thing. |
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
import {CharStream} from "./CharStream"; | ||
import {TokenSource} from "./TokenSource"; | ||
import {InputStream} from "./InputStream"; | ||
|
||
export declare class Token { | ||
|
||
|
@@ -7,6 +9,7 @@ export declare class Token { | |
static DEFAULT_CHANNEL: number; | ||
static HIDDEN_CHANNEL: number; | ||
|
||
source: [ TokenSource, InputStream ]; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd rather you add There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have a method where I refer to the
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry, maybe what I wrote was a little misunderstood. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm really not keen to expose such a poorly designed construct. The d.ts file already has |
||
tokenIndex: number; | ||
line: number; | ||
column: number; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe rather add
getMode
angetModeStack
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The public fields would be better for me because I have also used them in my various portings:
Java port
JavaScript port
Pyton port
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well these fields are clearly private... (I guess there was a bit of laziness with the first implementation 30 years ago)