mirror of
https://github.com/ParkerTenBroeck/automata.git
synced 2026-06-07 05:28:45 -04:00
some form of highlighting
This commit is contained in:
parent
58fb1b956c
commit
7f519cd7f3
12 changed files with 209 additions and 114 deletions
|
|
@ -176,8 +176,8 @@ impl<'a, 'b> FaCompiler<'a, 'b> {
|
|||
self.ctx.emit_error(format!("unknown item {name:?}, expected states | alphabet | final states | initial state"), dest_s);
|
||||
}
|
||||
|
||||
TL::TransitionFunc(S((S(delta_lower!(pat), _), args), _), list) => {
|
||||
self.compile_transition_function(args, list)
|
||||
TL::TransitionFunc(S((S(delta_lower!(pat), _), args), func), list) => {
|
||||
self.compile_transition_function(args, func, list)
|
||||
}
|
||||
TL::TransitionFunc(S((S(name, _), _), dest_s), _) => {
|
||||
self.ctx.emit_error(
|
||||
|
|
@ -313,6 +313,7 @@ impl<'a, 'b> FaCompiler<'a, 'b> {
|
|||
fn compile_transition_function(
|
||||
&mut self,
|
||||
args: Spanned<ast::Tuple<'a>>,
|
||||
function: Span,
|
||||
list: Spanned<ast::Item<'a>>,
|
||||
) {
|
||||
let list = list.set_weak();
|
||||
|
|
@ -368,8 +369,7 @@ impl<'a, 'b> FaCompiler<'a, 'b> {
|
|||
}
|
||||
if let Some(previous) = entry.replace(TransitionTo {
|
||||
state: State(next_state.0),
|
||||
|
||||
function: args.1,
|
||||
function,
|
||||
transition: item.1,
|
||||
}) {
|
||||
self.ctx
|
||||
|
|
|
|||
|
|
@ -264,8 +264,8 @@ impl<'a, 'b> PdaCompiler<'a, 'b> {
|
|||
self.ctx.emit_error(format!("unknown item {name:?}, expected states | stack symbols | alphabet | accept by | final states | initial state | initial stack"), dest_s);
|
||||
}
|
||||
|
||||
TL::TransitionFunc(S((S(delta_lower!(pat), _), args), _), list) => {
|
||||
self.compile_transition_function(args, list)
|
||||
TL::TransitionFunc(S((S(delta_lower!(pat), _), args), func), list) => {
|
||||
self.compile_transition_function(args, func, list)
|
||||
}
|
||||
TL::TransitionFunc(S((S(name, _), _), dest_s), _) => {
|
||||
self.ctx.emit_error(
|
||||
|
|
@ -476,6 +476,7 @@ impl<'a, 'b> PdaCompiler<'a, 'b> {
|
|||
fn compile_transition_function(
|
||||
&mut self,
|
||||
args: Spanned<ast::Tuple<'a>>,
|
||||
function: Span,
|
||||
list: Spanned<ast::Item<'a>>,
|
||||
) {
|
||||
let list = list.set_weak();
|
||||
|
|
@ -559,8 +560,8 @@ impl<'a, 'b> PdaCompiler<'a, 'b> {
|
|||
if !entry.insert(TransitionTo {
|
||||
state: State(next_state.0),
|
||||
stack,
|
||||
|
||||
function: args.1,
|
||||
|
||||
function,
|
||||
transition: item.1,
|
||||
}) {
|
||||
self.ctx.emit_warning("duplicate transition", item.1);
|
||||
|
|
|
|||
|
|
@ -193,8 +193,8 @@ impl<'a, 'b> TmCompiler<'a, 'b> {
|
|||
self.ctx.emit_error(format!("unknown item {name:?}, expected states | symbols | final states | initial state | blank symbol"), dest_s);
|
||||
}
|
||||
|
||||
TL::TransitionFunc(S((S(delta_lower!(pat), _), args), _), list) => {
|
||||
self.compile_transition_function(args, list)
|
||||
TL::TransitionFunc(S((S(delta_lower!(pat), _), args), func), list) => {
|
||||
self.compile_transition_function(args, func, list)
|
||||
}
|
||||
TL::TransitionFunc(S((S(name, _), _), dest_s), _) => {
|
||||
self.ctx.emit_error(
|
||||
|
|
@ -349,6 +349,7 @@ impl<'a, 'b> TmCompiler<'a, 'b> {
|
|||
fn compile_transition_function(
|
||||
&mut self,
|
||||
args: Spanned<ast::Tuple<'a>>,
|
||||
function: Span,
|
||||
list: Spanned<ast::Item<'a>>,
|
||||
) {
|
||||
let list = list.set_weak();
|
||||
|
|
@ -398,7 +399,7 @@ impl<'a, 'b> TmCompiler<'a, 'b> {
|
|||
symbol: Symbol(to_tape.0),
|
||||
direction: direction.0,
|
||||
|
||||
function: args.1,
|
||||
function,
|
||||
transition: item.1,
|
||||
}) {
|
||||
self.ctx.emit_warning("duplicate transition", item.1);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue