update target docs that need alteration for new interface

This commit is contained in:
parrt 2017-03-29 14:59:14 -07:00
parent 66d2d7455d
commit 40e1072e7e
3 changed files with 4 additions and 4 deletions

View File

@ -239,7 +239,7 @@ AnnotatingErrorListener.prototype.syntaxError = function(recognizer, offendingSy
With this, all that remains to be done is plug the listener in when we parse the code. Here is how I do it:
```js
var validate = function(input) {
var stream = new antlr4.InputStream(input);
var stream = CharStreams.fromString(input);
var lexer = new mylanguage.MyLexer(stream);
var tokens = new antlr4.CommonTokenStream(lexer);
var parser = new mylanguage.MyParser(tokens);
@ -252,4 +252,4 @@ var validate = function(input) {
};
```
You know what? That's it! You now have an ACE editor that does syntax validation using ANTLR! I hope you find this useful, and simple enough to get started.
WNow wait, hey! How do you debug this? Well, as usual, using Chrome, since no other browser is able to debug worker code. What a shame...
Now wait, hey! How do you debug this? Well, as usual, using Chrome, since no other browser is able to debug worker code. What a shame...

View File

@ -35,7 +35,7 @@ using Antlr4.Runtime;
public void MyParseMethod() {
String input = "your text to parse here";
AntlrInputStream stream = new InputStream(input);
ICharStream stream = new CharStreams.fromString(input);
ITokenSource lexer = new MyGrammarLexer(stream);
ITokenStream tokens = new CommonTokenStream(lexer);
MyGrammarParser parser = new MyGrammarParser(tokens);

View File

@ -96,7 +96,7 @@ Now a fully functioning script might look like the following:
```javascript
var input = "your text to parse here"
var chars = new antlr4.InputStream(input);
var chars = CharStreams.fromString(input);
var lexer = new MyGrammarLexer.MyGrammarLexer(chars);
var tokens = new antlr4.CommonTokenStream(lexer);
var parser = new MyGrammarParser.MyGrammarParser(tokens);