Class: Rouge::Lexers::XPath

Inherits:
RegexLexer show all
Defined in:
lib/rouge/lexers/xpath.rb

Direct Known Subclasses

XQuery

Constant Summary

Constants inherited from RegexLexer

RegexLexer::MAX_NULL_SCANS

Constants included from Token::Tokens

Token::Tokens::Num, Token::Tokens::Str

Instance Attribute Summary

Attributes inherited from Rouge::Lexer

#options

Class Method Summary collapse

Methods inherited from RegexLexer

append, #delegate, #goto, #group, #groups, #in_state?, #pop!, prepend, #push, #recurse, replace_state, #reset!, #reset_stack, #stack, start, start_procs, state, #state, #state?, state_definitions, states, #step, #stream_tokens, #token

Methods inherited from Rouge::Lexer

aliases, all, #as_bool, #as_lexer, #as_list, #as_string, #as_token, #bool_option, continue_lex, #continue_lex, debug_enabled?, demo, demo_file, desc, detect?, detectable?, disable_debug!, enable_debug!, filenames, find, find_fancy, guess, guess_by_filename, guess_by_mimetype, guess_by_source, guesses, #hash_option, #initialize, lex, #lex, #lexer_option, #list_option, lookup_fancy, mimetypes, option, option_docs, #reset!, #stream_tokens, #string_option, tag, #tag, title, #token_option, #with

Methods included from Token::Tokens

token

Constructor Details

This class inherits a constructor from Rouge::Lexer

Class Method Details

.axesObject



67
68
69
70
71
72
73
# File 'lib/rouge/lexers/xpath.rb', line 67

def self.axes
  @axes ||= Regexp.union %w(
    child descendant attribute self descendant-or-self
    following-sibling following namespace
    parent ancestor preceding-sibling preceding ancestor-or-self
  )
end

.commentStartObject



46
47
48
# File 'lib/rouge/lexers/xpath.rb', line 46

def self.commentStart
  @commentStart ||= %r/\(:/
end

.constructorTypesObject



92
93
94
# File 'lib/rouge/lexers/xpath.rb', line 92

def self.constructorTypes
  @constructorTypes ||= Regexp.union %w(function array map empty-sequence)
end

.decimalLiteralObject



18
19
20
# File 'lib/rouge/lexers/xpath.rb', line 18

def self.decimalLiteral
  @decimalLiteral ||= %r/\.#{digits}|#{digits}\.[0-9]*/
end

.digitsObject



14
15
16
# File 'lib/rouge/lexers/xpath.rb', line 14

def self.digits
  @digits ||= %r/[0-9]+/
end

.doubleLiteralObject



22
23
24
# File 'lib/rouge/lexers/xpath.rb', line 22

def self.doubleLiteral
  @doubleLiteral ||= %r/(\.#{digits})|#{digits}(\.[0-9]*)?[eE][+-]?#{digits}/
end

.eqNameObject



42
43
44
# File 'lib/rouge/lexers/xpath.rb', line 42

def self.eqName
  @eqName ||= %r/(?:#{uriQName}|#{qName})/
end

.keywordsObject



79
80
81
# File 'lib/rouge/lexers/xpath.rb', line 79

def self.keywords
  @keywords ||= Regexp.union %w(let for some every if then else return in satisfies)
end

.kindTestObject



56
57
58
59
60
61
# File 'lib/rouge/lexers/xpath.rb', line 56

def self.kindTest
  @kindTest ||= Regexp.union %w(
    element attribute schema-element schema-attribute
    comment text node document-node namespace-node
  )
end

.kindTestForPIObject



63
64
65
# File 'lib/rouge/lexers/xpath.rb', line 63

def self.kindTestForPI
  @kindTestForPI ||= Regexp.union %w(processing-instruction)
end

.ncNameObject



30
31
32
# File 'lib/rouge/lexers/xpath.rb', line 30

def self.ncName
  @ncName ||= %r/[a-z_][a-z_\-.0-9]*/i
end

.openParenObject



50
51
52
# File 'lib/rouge/lexers/xpath.rb', line 50

def self.openParen
  @openParen ||= %r/\((?!:)/
end

.operatorsObject



75
76
77
# File 'lib/rouge/lexers/xpath.rb', line 75

def self.operators
  @operators ||= Regexp.union %w(, => = := : >= >> > <= << < - * != + // / || |)
end

.qNameObject



34
35
36
# File 'lib/rouge/lexers/xpath.rb', line 34

def self.qName
  @qName ||= %r/(?:#{ncName})(?::#{ncName})?/
end

.stringLiteralObject



26
27
28
# File 'lib/rouge/lexers/xpath.rb', line 26

def self.stringLiteral
  @stringLiteral ||= %r/("(("")|[^"])*")|('(('')|[^'])*')/
end

.uriQNameObject



38
39
40
# File 'lib/rouge/lexers/xpath.rb', line 38

def self.uriQName
  @uriQName ||= %r/Q\{[^{}]*\}#{ncName}/
end

.word_operatorsObject



83
84
85
86
87
88
89
90
# File 'lib/rouge/lexers/xpath.rb', line 83

def self.word_operators
  @word_operators ||= Regexp.union %w(
    and or eq ge gt le lt ne is
    div mod idiv
    intersect except union
    to
  )
end