Skip to content

Commit

Permalink
Parser docs
Browse files Browse the repository at this point in the history
  • Loading branch information
gareththegeek committed Sep 11, 2018
1 parent ff93166 commit 796be36
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions docs/developer/parser.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ The `IParseResult` has the following structure:
}
```

#### Token Categories

The token category number is an enumerated type with the following possible values:

|Value|Meaning|
Expand Down Expand Up @@ -64,3 +66,20 @@ The message type number is an enumerated type with the following possible values
### serialise(tokens: IToken[]): string

Serialises the array of tokens to a single, human readable string.

The `serialise` function takes a single parameter which is an array of tokens with the following structure:

```
[{
position: {
line: number,
char: number
},
lexeme: string,
category: number
}]
```

The lexeme contains the original text which produced the token.

A list of valid values for category can be found [here](#token-categories).

0 comments on commit 796be36

Please sign in to comment.