- Added some doodads
- Documented
This commit is contained in:
Tristan B. Velloza Kildaire 2024-04-02 22:04:25 +02:00
parent 638284976a
commit 8dfd3f001f
1 changed files with 24 additions and 1 deletions

View File

@ -9,8 +9,15 @@ import tlang.compiler.lexer.core;
import core.stdc.stdlib;
import misc.exceptions : TError;
import tlang.compiler.parsing.exceptions;
import tlang.compiler.reporting : LineInfo;Par
// TODO: Technically we could make a core parser etc
/**
* Provided with a lexer this
* can parse the tokens into
* an in-memory AST structure
*
* Authors: Tristan Brice Velloza Kildaire (deavmi)
*/
public final class Parser
{
/**
@ -18,6 +25,22 @@ public final class Parser
*/
private LexerInterface lexer;
/**
* Returns the `LineInfo` of
* the lexer's current token.
*
* This is useful when you want
* to associate a line with
* an AST node right before
* returning.
*
* Returns: the `LineInfo`
*/
private LineInfo getCurrentLineInfo()
{
return this.lexer.getCurrentToken().getLineInfo();
}
/**
* Crashes the program if the given token is not a symbol
* the same as the givne expected one