Skip to content

Commit

Permalink
FEAT - Created static Lexer and feature flags
Browse files Browse the repository at this point in the history
  • Loading branch information
KrosFire committed Aug 28, 2024
1 parent e4b9f35 commit 3f5d498
Show file tree
Hide file tree
Showing 7 changed files with 631 additions and 105 deletions.
11 changes: 11 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,17 @@ authors = ["[email protected]"]
keywords = ["heraclitus", "compiler", "parser"]

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[features]
default = ["compiler"]

# Include the compiler and lexer
compiler = ["lexer_dynamic"]

# Include the lexer
lexer_dynamic = []

# Include the static lexer
lexer_static = []

[dependencies]
colored = "2.0.0"
Expand Down
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,16 @@ let cc = Compiler::new("HerbScript", rules);
let tokens = cc.tokenize()?;
```

## Features

You can import specific features from Heraclitus. Available options are:

- `compiler` - Includes Compiler and dynamic Lexer
- `lexer_dynamic` - Includes just the dynamic Lexer
- `lexer_static` - Includes just the static Lexer

The difference between `static` and `dynamic` Lexer is that the `static` Lexer doesn't mutate it's own state while tokenizing the input.

# Change log 🚀

## Version 1.7.8
Expand Down
3 changes: 2 additions & 1 deletion src/compiling/compiler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ use capitalize::Capitalize;
use std::fs::File;
use std::io::prelude::*;
use crate::compiling_rules::Rules;
use crate::compiling::{Token, Lexer, LexerError, LexerErrorType, Metadata, SyntaxModule};
use crate::compiling::{Token, LexerError, LexerErrorType, Metadata, SyntaxModule};
use crate::compiling::failing::message::Message;
use crate::compiling::failing::failure::Failure;
use crate::error_pos;

use super::lexer::Lexer;

/// How do you want to separate expressions?
///
Expand Down
Loading

0 comments on commit 3f5d498

Please sign in to comment.