Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -750,6 +750,12 @@ bool isTerminal((Sym) `<Sym symbol> $`) = isTerminal(symbol);
bool isTerminal((Sym) `^ <Sym symbol>`) = isTerminal(symbol);
bool isTerminal((Sym) `<Sym symbol> ! <NonterminalLabel _>`) = isTerminal(symbol);

bool isTerminal((Sym) `<Sym symbol> \>\> <Sym match>`) = isTerminal(symbol);
bool isTerminal((Sym) `<Sym symbol> !\>\> <Sym match>`) = isTerminal(symbol);
bool isTerminal((Sym) `<Sym match> \<\< <Sym symbol>`) = isTerminal(symbol);
bool isTerminal((Sym) `<Sym match> !\<\< <Sym symbol>`) = isTerminal(symbol);
bool isTerminal((Sym) `<Sym match> \\ <Sym symbol>`) = isTerminal(match);

default bool isTerminal(Sym s)
= s is literal || s is caseInsensitiveLiteral || s is characterClass;

Expand Down Expand Up @@ -784,6 +790,7 @@ void collect(current:(Sym) `<Sym match> \<\< <Sym symbol>`, Collector c){
void collect(current:(Sym) `<Sym match> !\<\< <Sym symbol>`, Collector c){
c.calculate("notPrecede", current, [match, symbol],
AType(Solver s) {
println("isTerminal(<match>): <isTerminal(match)>");

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this debug print should be removed, but apart from that, looks good.

s.requireTrue(isTerminal(match), warning(match, "Not Preceded By (`!\<\<`) requires literal or character class, found %v", match));
return AType::conditional(s.getType(symbol), {ACondition::\not-precede(s.getType(match)) });
});
Expand Down
Loading