Conversation
…ghlighting-compiler
DHowett
left a comment
There was a problem hiding this comment.
14/19 plus high water mark of 171 on generator.rs; still ongoing
| JumpIfMatchPrefixInsensitive { idx: u32, tgt: u32 }, | ||
|
|
||
| // Flushes the current HighlightKind to the output. | ||
| FlushHighlight { kind: Register }, |
There was a problem hiding this comment.
(why is this its own instruction instead of a register? i guess having a special register would mean you need to check writes to every register to see if it was the special output register. however, you already have that with pc...)
| //! | `[a-z]?` | `Charset{cs, min=0, max=1}` - optional char | | ||
| //! | `$` | `EndOfLine` condition | | ||
| //! | `.*` | `MovImm off, MAX` - skip to end of line | | ||
| //! | `\>` | `If Charset(\w) then FAIL else MATCH` - word boundary | |
There was a problem hiding this comment.
this feels like a vim-ism; everyone else uses \b for word boundary... right?
| //! | `[a-z]+` | `Charset{cs, min=1, max=∞}` - greedy char class | | ||
| //! | `[a-z]?` | `Charset{cs, min=0, max=1}` - optional char | |
There was a problem hiding this comment.
actually these are Repeat{Charset{cs}, min=..., max=...}
There was a problem hiding this comment.
nm, not in the IR they're not! only in the regex layer. ignore
| } | ||
| } | ||
|
|
||
| /// a|b|c |
There was a problem hiding this comment.
"or a", because this is also the parser for the no-alternation case
| Ok(Regex::Group { inner: Box::new(inner), capturing: false }) | ||
| } | ||
| Some('i') => { | ||
| // Case-insensitive (?i:...) |
There was a problem hiding this comment.
does this mean we can't have a capturing ?i?
|
|
||
| let mut charset = Charset::no(); | ||
|
|
||
| // First char can be ] or - literally |
| optimize_noop(compiler); | ||
| } | ||
|
|
||
| /// This isn't an optimization for the VM, it's one for my autistic side. |
There was a problem hiding this comment.
nope. can't say this, i'm sorry.
| //! | ||
| //! ## TODO | ||
| //! | ||
| //! - The label lookup (with a `HashMap`) is just plain dumb. |
There was a problem hiding this comment.
"lookup ... could be improved" ;)
DHowett
left a comment
There was a problem hiding this comment.
Reviewed everything, just need a couple comment changes and a quick question answered and I think I'm ready to sign off!
| let end = self.compiler.alloc_noop(); | ||
|
|
||
| // Handle optional else branch | ||
| let next = if self.is_keyword("else") { |
| lhs_span.last.borrow_mut().set_next(add_ir); | ||
| Ok((IRSpan { first: lhs_span.first, last: add_ir }, lhs_vreg)) | ||
| } else if lhs_vreg.borrow().physical.is_some() { | ||
| // For expressions of type `var virtual = phyiscal;`, we need to ensure |
There was a problem hiding this comment.
| // For expressions of type `var virtual = phyiscal;`, we need to ensure | |
| // For expressions of type `var virtual = physical;`, we need to ensure |
|
|
||
| ir = next.borrow_mut(); | ||
|
|
||
| if ir.offset != usize::MAX { |
There was a problem hiding this comment.
(to add a dead loop at the end of the assembly?)
This PR contains no CLI frontend, etc., for the compiler,
as I split out everything but the compiler to reduce the PR size.
Part of #624