Skip to content

Commit

Permalink
fixed example in documentation of ParseTree modules
Browse files Browse the repository at this point in the history
  • Loading branch information
jurgenvinju committed Jun 8, 2023
1 parent 09d68c4 commit b5c665e
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/org/rascalmpl/library/ParseTree.rsc
Original file line number Diff line number Diff line change
Expand Up @@ -422,16 +422,21 @@ to false. So this is quite an important flag to consider.

#### Examples

```rascal-shell,error
import demo::lang::Exp::Concrete::NoLayout::Syntax;
```rascal-shell
lexical Number = [0-9]+;
syntax Exp
= Number
| left Exp "+" Exp
;

import ParseTree;
```
Seeing that `parse` returns a parse tree:
```rascal-shell,continue,error
```rascal-shell,continue
parse(#Exp, "2+3");
```
Catching a parse error:
```rascal-shell,continue,error
```rascal-shell,continue
import IO;
try {
Exp e = parse(#Exp, "2@3");
Expand Down

0 comments on commit b5c665e

Please sign in to comment.