Class: TracePreprocessor::DSL
- Inherits:
-
Object
- Object
- TracePreprocessor::DSL
- Defined in:
- lib/trace_preprocessor/dsl.rb
Instance Attribute Summary collapse
-
#code ⇒ Object
Returns the value of attribute code.
-
#lexemes ⇒ Object
Returns the value of attribute lexemes.
-
#output_token_code ⇒ Object
Returns the value of attribute output_token_code.
-
#workspace_path ⇒ Object
Returns the value of attribute workspace_path.
Instance Method Summary collapse
- #common_code(code) ⇒ Object
- #define_lexeme(name, options) ⇒ Object
- #init(&block) ⇒ Object
-
#initialize ⇒ DSL
constructor
A new instance of DSL.
- #output_token(code) ⇒ Object
- #workspace(path) ⇒ Object
Constructor Details
#initialize ⇒ DSL
Returns a new instance of DSL.
11 12 13 14 |
# File 'lib/trace_preprocessor/dsl.rb', line 11 def initialize @lexemes = {} @code = "" end |
Instance Attribute Details
#code ⇒ Object
Returns the value of attribute code.
53 54 55 |
# File 'lib/trace_preprocessor/dsl.rb', line 53 def code @code end |
#lexemes ⇒ Object
Returns the value of attribute lexemes.
52 53 54 |
# File 'lib/trace_preprocessor/dsl.rb', line 52 def lexemes @lexemes end |
#output_token_code ⇒ Object
Returns the value of attribute output_token_code.
53 54 55 |
# File 'lib/trace_preprocessor/dsl.rb', line 53 def output_token_code @output_token_code end |
#workspace_path ⇒ Object
Returns the value of attribute workspace_path.
54 55 56 |
# File 'lib/trace_preprocessor/dsl.rb', line 54 def workspace_path @workspace_path end |
Instance Method Details
#common_code(code) ⇒ Object
36 37 38 |
# File 'lib/trace_preprocessor/dsl.rb', line 36 def common_code code @code += code end |
#define_lexeme(name, options) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/trace_preprocessor/dsl.rb', line 20 def define_lexeme name, lexeme = @lexemes[name] || Lexeme.new(name) lexeme.regexp = [:regexp] lexeme.value_kind = [:value_kind] || :hash converter = [:converter] converter_language = :c converter_language = :ruby if converter.instance_of? Proc lexeme.converter[converter_language] = converter @lexemes[lexeme.name] = lexeme lexeme end |
#init(&block) ⇒ Object
16 17 18 |
# File 'lib/trace_preprocessor/dsl.rb', line 16 def init &block instance_eval &block end |
#output_token(code) ⇒ Object
40 41 42 |
# File 'lib/trace_preprocessor/dsl.rb', line 40 def output_token code @output_token_code = code end |
#workspace(path) ⇒ Object
44 45 46 47 48 49 50 |
# File 'lib/trace_preprocessor/dsl.rb', line 44 def workspace path @workspace_path = File. path if not File.exist? @workspace_path FileUtils.mkdir_p @workspace_path end end |