Skip to content

Commit

Permalink
a
Browse files Browse the repository at this point in the history
  • Loading branch information
pieter-bos committed May 24, 2024
1 parent 958b5b7 commit 842484b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/parsers/antlr4/SpecLexer.g4
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ VAL_SET: 'set';
VAL_BAG: 'bag';
VAL_POINTER: 'pointer';
VAL_MAP: 'map';
VAL_OPTION: 'option' <category=spec_type_cons>;
VAL_OPTION options { category=spec_type_cons } : 'option';
VAL_EITHER: 'either';
VAL_TUPLE: 'tuple';
VAL_TYPE: 'type';
Expand Down Expand Up @@ -137,7 +137,7 @@ FORALL: '\\forall';
EXISTS: '\\exists';
FORPERM: '\\forperm';
FORPERMWITHVALUE: '\\forpermwithvalue';
FORALL_UNICODE: '';
FORALL_UNICODE: '\u2200';
FORALL_STAR_UNICODE: '\u2200*';
EXISTS_UNICODE: '\u2203';
LET: '\\let';
Expand Down
13 changes: 12 additions & 1 deletion src/textMateGenerator/gen/Main.scala
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,24 @@ case object Main {
}

def processRule(rule: LexerRuleSpecContext): Unit = {
val LexerRuleSpec0(_, name, _, _, LexerRuleBlock0(altsRule), _) = rule
val LexerRuleSpec0(_, name, _, _, LexerRuleBlock0(alts), _) = rule
val alts = altsRule.children.asScala.collect { case alt: LexerAltContext => alt }
val set = new IntervalSet()
set.addAll(set)
println(name)
}

sealed trait RegLang
case class CharInSet(chars: IntervalSet)
case class Alts(langs: Seq[RegLang]) extends RegLang
case class Seqn(langs: Seq[RegLang]) extends RegLang
case class Star(lang: RegLang, greedy: Boolean) extends RegLang
case class Plus(lang: RegLang, greedy: Boolean) extends RegLang
case class QMark(lang: RegLAng, greedy: Boolean) extends RegLang

def asRegLang(alts: LexerAltListContext): RegLang =


def escapeAndEncloseWords(text: String): String = {
val stringWithEscapedSymbols = text.replaceAll("([^\\w\\\\])", "\\\\$1")
val wordsWithBoundaries = stringWithEscapedSymbols.replaceAll("\\b(\\w+)\\b", "\\\\b(?:$1)\\\\b")
Expand Down

0 comments on commit 842484b

Please sign in to comment.