⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 token_stream_basic_filter.sa

📁 SRI international 发布的OAA框架软件
💻 SA
字号:
(* 

  ANTLR Translator Generator
  Project led by Terence Parr at http://www.jGuru.com
  Software rights: http://www.antlr.org/RIGHTS.html
 
  $Id: token_stream_basic_filter.sa,v 1.1.1.1 2002/01/02 19:59:09 agno Exp $

*)

class ANTLR_TOKEN_STREAM_BASIC_FILTER{ TOKEN < $ANTLR_TOKEN } < $ANTLR_TOKEN_STREAM{ TOKEN } is
   
   -- the set of token types to discard
   attr discard_set : INT_SET;

   -- the input stream
   private attr input : $ANTLR_TOKEN_STREAM{TOKEN};
   
   discard_type( ttype : INT ) is
      discard_set := discard_set.insert( ttype );
   end;
   
   create( input : $ANTLR_TOKEN_STREAM{TOKEN} ) : SAME is
      res : SAME := new;
      res.input := input;
      res.discard_set := #INT_SET;
      return res;
   end;

   next_token : TOKEN is

      tok : TOKEN := input.next_token;
      loop while!( ~void(tok) and discard_set.member( tok.ttype ) );
	 tok := input.next_token;
      end;
      return tok;

   end;
   
end;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -