Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- options
- {
- static = false;
- DEBUG_PARSER=true;
- }
- PARSER_BEGIN(Comentarios)
- import java.io.FileInputStream;
- import java.io.File;
- import java.io.IOException;
- public class Comentarios
- {
- public static void main(String args []) throws ParseException
- {
- try
- {
- System.out.println("Lendo arquivo fonte...");
- FileInputStream fis = new FileInputStream(new File("..//JavaCC//src//comentarios.txt"));
- Comentarios parser = new Comentarios(fis);
- parser.Start();
- System.out.println("Arquivo fonte processado corretamente!");
- }
- catch (IOException e)
- {
- System.out.println("Falha ao abrir arquivo fonte.");
- System.exit(0);
- }
- }
- }
- PARSER_END(Comentarios)
- SKIP : { " "| "\t" | "\n" | "\r" }
- TOKEN:
- {
- //Tudo menos nova linha e enter
- < SINGLE_LINE: "//" (~["\n"])* "\n" >
- }
- TOKEN:
- {
- < MULTIPLE_LINE: "/*" (~["*"])* "*" (~["*","/"] (~["*"])* "*" | "*")* "/">
- }
- void Start() :
- { }
- {
- (
- (< SINGLE_LINE > | <MULTIPLE_LINE >)* < EOF >
- )
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement