From 7eec21ffce3f71a7111fd664c109e16632c55def Mon Sep 17 00:00:00 2001 From: Lior Dinf <ls12@inf.ufpr.br> Date: Wed, 22 Apr 2015 18:04:45 -0300 Subject: [PATCH] Init --- compiler/Lexer.scala | 23 +++++++++++++++++++++++ compiler/teste.scala | 5 +++++ 2 files changed, 28 insertions(+) create mode 100644 compiler/Lexer.scala create mode 100644 compiler/teste.scala diff --git a/compiler/Lexer.scala b/compiler/Lexer.scala new file mode 100644 index 0000000..6590f57 --- /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 0000000..e5f6fe0 --- /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 _ => +} -- GitLab