Class: Syntax::Token

Inherits:
String show all
Defined in:
lib/zena/code/default_syntax.rb

Overview

changed ‘Token’ class to make recursive calls possible

Constant Summary

Constants inherited from String

String::ALLOWED_CHARS_IN_FILENAME, String::ALLOWED_CHARS_IN_FILEPATH, String::ALLOWED_CHARS_IN_URL, String::TO_FILENAME_REGEXP, String::TO_URL_NAME_REGEXP

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from String

#abs_path, from_filename, from_url_name, #limit, #rel_path, #to_filename, #to_filename!, #url_name, #url_name!, #urlencode

Constructor Details

#initialize(text, group, instruction = :none, escape = true) ⇒ Token

Create a new Token representing the given text, and belonging to the given group.



56
57
58
59
60
61
# File 'lib/zena/code/default_syntax.rb', line 56

def initialize( text, group, instruction = :none, escape = true )
  super text
  @group = group
  @instruction = instruction
  @escape = escape
end

Instance Attribute Details

#escapeObject (readonly)

true if this token’s html tags should be escaped



52
53
54
# File 'lib/zena/code/default_syntax.rb', line 52

def escape
  @escape
end

#groupObject (readonly)

the type of the lexeme that was extracted.



45
46
47
# File 'lib/zena/code/default_syntax.rb', line 45

def group
  @group
end

#instructionObject (readonly)

the instruction associated with this token (:none, :region_open, or :region_close)



49
50
51
# File 'lib/zena/code/default_syntax.rb', line 49

def instruction
  @instruction
end