Skip to content
Snippets Groups Projects
Commit 7539d652 authored by Lior Spach's avatar Lior Spach
Browse files

c3

parent 6d8485bd
No related branches found
No related tags found
No related merge requests found
package lexer
trait Definicoes {
//Conjuntos
val palavrasReservadas = List("begin", "end", "function", "procedure", "var", "program",
"label","integer","goto","if","then","else","read","write",
"while","do")
val letras = List.concat('a' to 'z', 'A' to 'Z', "_")
val numeros = ('0' to '9').toList
val separadores = List(' ', '\t', '\n', ';',',',':')
val operadores =
"+ - * / += -= *= /= ++ -- = < > <= >= <> :=".split(" ").toList
//Funcoes booleanas
val operadorValido = (s: String) => operadores.contains(s)
val ehNum = (c: Char) => numeros.contains(c)
val ehOp = (c: Char) => "+-*/=:><".contains(c)
val ehLetra = (c: Char) => letras.contains(c)
val ehEspacoLinTab = (c: Char) => c == ' ' || c == '\t' || c == '\n' || c == 13
val ehSeparador = (c: Char) => separadores.contains(c)
val ehPalavraReservada = (s: String) => palavrasReservadas.contains(s)
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment