diff --git a/compiler/Lexer.scala b/compiler/Lexer.scala new file mode 100644 index 0000000000000000000000000000000000000000..6590f57df75fc4f3fb8ce51c03bd495eef93650c --- /dev/null +++ b/compiler/Lexer.scala @@ -0,0 +1,23 @@ +import io.{Source,BufferedSource} + +case class Atomo(val valor:String, val token:String) + +object Lexer { + def getTokens(stream:Iterator[Char]):List[atomo] = { + var proximo: Char = '' + var acc = "" + + def PROX = if (stream.hasNext) proximo = stream.next + def ADD = acc + proximo + + PROX + proximo match { //TODO: Pattern Matching + case ' ' || '\t' || '\n' => + case letra => + case numero => + case simbolo_especial => + } + + } + +} diff --git a/compiler/teste.scala b/compiler/teste.scala new file mode 100644 index 0000000000000000000000000000000000000000..e5f6fe0b2d5ae657dc90d8088600cd44521de356 --- /dev/null +++ b/compiler/teste.scala @@ -0,0 +1,5 @@ +val Pattern = """\(([a-cA-C]{3})\)""".r +args(0) match { + case Pattern(c) => println(c) + case _ => +}