Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,11 @@ TypeScript 2.0.
5. Use your grammar in TypeScript

```typescript
import { ANTLRInputStream, CommonTokenStream } from 'antlr4ts';
import { CodePointCharStream, CodePointBuffer, CommonTokenStream } from 'antlr4ts';

// Create the lexer and parser
let inputStream = new ANTLRInputStream("text");
let buffer = Buffer.from("text");
let inputStream = CodePointCharStream.fromBuffer(new CodePointBuffer(buffer, buffer.length));
Copy link

@AJamesPhillips AJamesPhillips Oct 10, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also found the deprecated code confusing so thanks for this PR.
My IDE's recommended replacement was

const inputStream = CharStreams.fromString("text")

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah you're right, that one is even better.

let lexer = new MyGrammarLexer(inputStream);
let tokenStream = new CommonTokenStream(lexer);
let parser = new MyGrammarParser(tokenStream);
Expand Down