Module: ANTLR3
- Includes:
- AST, Constants, Error
- Defined in:
- lib/antlr3.rb,
lib/antlr3/dfa.rb,
lib/antlr3/dot.rb,
lib/antlr3/task.rb,
lib/antlr3/util.rb,
lib/antlr3/main.rb,
lib/antlr3/tree.rb,
lib/antlr3/error.rb,
lib/antlr3/debug.rb,
lib/antlr3/token.rb,
lib/antlr3/version.rb,
lib/antlr3/profile.rb,
lib/antlr3/streams.rb,
lib/antlr3/template.rb,
lib/antlr3/constants.rb,
lib/antlr3/tree/debug.rb,
lib/antlr3/tree/wizard.rb,
lib/antlr3/recognizers.rb,
lib/antlr3/token/linked.rb,
lib/antlr3/tree/visitor.rb,
lib/antlr3/debug/socket.rb,
lib/antlr3/test/grammar.rb,
lib/antlr3/modes/filter.rb,
lib/antlr3/test/functional.rb,
lib/antlr3/streams/unicode.rb,
lib/antlr3/streams/rewrite.rb,
lib/antlr3/debug/event-hub.rb,
lib/antlr3/modes/ast-builder.rb,
lib/antlr3/debug/rule-tracer.rb,
lib/antlr3/template/parameter.rb,
lib/antlr3/streams/interactive.rb,
lib/antlr3/template/group-file.rb,
lib/antlr3/template/group-file-lexer.rb,
lib/antlr3/debug/trace-event-listener.rb,
lib/antlr3/template/group-file-parser.rb,
lib/antlr3/debug/record-event-listener.rb
Overview
- The "BSD licence"
-
Copyright (c) 2009-2011 Kyle Yetter All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The name of the author may not be used to endorse or promote products derived from this software without specific prior written permission.THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Defined Under Namespace
Modules: AST, ASTBuilder, CharacterStream, ClassMacros, Constants, DOT, Debug, Error, FilterMode, Main, Profile, Rewrite, Stream, Template, Test, Token, TokenFactory, TokenSource, TokenStream, Util Classes: Bug, ChainedToken, ChainedTokenStream, CommonToken, CommonTokenStream, CompileTask, DFA, FileStream, InteractiveStringStream, Lexer, Parser, Recognizer, RecognizerSharedState, Scope, StringStream, TokenRewriteStream, TokenScheme, UnicodeStream
Constant Summary
- LIBRARY_PATH =
:stopdoc: BEGIN PATHS -- do not modify
::File.( ::File.dirname( __FILE__ ) ).freeze
- PROJECT_PATH =
::File.dirname( LIBRARY_PATH ).freeze
- DATA_PATH =
::File.join( PROJECT_PATH, 'java' ).freeze
- ANTLR_MAJOR_VERSION =
The version of the ANTLR tool used while designing and testing the current version of this library
3- ANTLR_MINOR_VERSION =
2- ANTLR_PATCH_VERSION =
1- ANTLR_VERSION =
[ ANTLR_MAJOR_VERSION, ANTLR_MINOR_VERSION, ANTLR_PATCH_VERSION ].freeze
- ANTLR_VERSION_STRING =
ANTLR_VERSION.join( '.' )
- MAJOR_VERSION =
The version data for the current state the library itself
1- MINOR_VERSION =
8- PATCH_VERSION =
11- VERSION =
[ MAJOR_VERSION, MINOR_VERSION, PATCH_VERSION ]
- VERSION_STRING =
VERSION.join( '.' ).freeze
- BaseRecognizer =
constant alias for compatibility with older versions of the runtime library
Recognizer
Constants included from Constants
Constants::BUILT_IN_TOKEN_NAMES, Constants::DEFAULT, Constants::DOWN, Constants::EOF, Constants::EOF_TOKEN, Constants::EOR_TOKEN_TYPE, Constants::HIDDEN, Constants::INVALID_TOKEN, Constants::INVALID_TOKEN_TYPE, Constants::MEMO_RULE_FAILED, Constants::MEMO_RULE_UNKNOWN, Constants::MIN_TOKEN_TYPE, Constants::SKIP_TOKEN, Constants::UP
Class Method Summary (collapse)
- + (Object) antlr_jar
- + (Object) antlr_jar=(path)
-
+ (Object) bug!(message = nil)
This is used internally in a handful of locations in the runtime library where assumptions have been made that a condition will never happen under normal usage conditions and thus an ANTLR3::Bug error will be raised if the condition does occur.
-
+ (Object) data_path(*args)
Returns the lpath for the module.
-
+ (Object) library_path(*args)
Returns the library path for the module.
Methods included from Error
#EarlyExit, #FailedPredicate, #MismatchedNotSet, #MismatchedRange, #MismatchedSet, #MismatchedToken, #MismatchedTreeNode, #MissingToken, #NoViableAlternative, #RewriteCardinalityError, #RewriteEarlyExit, #RewriteEmptyStream, #UnwantedToken
Class Method Details
+ (Object) antlr_jar
144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 |
# File 'lib/antlr3.rb', line 144 def self.antlr_jar @antlr_jar and return( @antlr_jar ) path = data_path "antlr-full-#{ ANTLR_VERSION_STRING }.jar" if env_path = ENV[ 'RUBY_ANTLR_JAR' ] if File.file?( env_path ) then return File.( env_path ) end warn( "#{ __FILE__ }:#{ __LINE__ }: " << "ignoring environmental variable RUBY_ANTLR_JAR (=%p) " % env_path << "as it is not the path to an existing file\n" << " -> trying default jar path %p instead" % path ) end File.exists?( path ) ? path : nil end |
+ (Object) antlr_jar=(path)
140 141 142 |
# File 'lib/antlr3.rb', line 140 def self.antlr_jar=( path ) @antlr_jar = path ? File.( path.to_s ) : path end |
+ (Object) bug!(message = nil)
This is used internally in a handful of locations in the runtime library where assumptions have been made that a condition will never happen under normal usage conditions and thus an ANTLR3::Bug error will be raised if the condition does occur.
132 133 134 135 136 |
# File 'lib/antlr3.rb', line 132 def self.bug!( = nil ) bug = Bug.new( ) bug.set_backtrace( caller ) raise( bug ) end |
+ (Object) data_path(*args)
Returns the lpath for the module. If any arguments are given, they will be joined to the end of the path using File.join.
124 125 126 |
# File 'lib/antlr3.rb', line 124 def self.data_path( *args ) ::File.( ::File.join( DATA_PATH, *args ) ) end |
+ (Object) library_path(*args)
Returns the library path for the module. If any arguments are given, they will be joined to the end of the libray path using File.join.
116 117 118 |
# File 'lib/antlr3.rb', line 116 def self.library_path( *args ) ::File.( ::File.join( LIBRARY_PATH, *args ) ) end |