Belle II Software  release-08-01-10
B2ParameterLexer Class Reference
Inheritance diagram for B2ParameterLexer:
Collaboration diagram for B2ParameterLexer:

Public Member Functions

def ARGUMENTTUPLE (self, t)
 

Public Attributes

 index
 Increment current scanning position.
 

Static Public Attributes

dictionary tokens = {ARGUMENTTUPLE, }
 Single token for matching metavariable parameters.
 

Detailed Description

Lexer class responsible for changing the default scanning behavior.
It disables token scanning and captures
everything within the matched parenthesis.
Call pop_state to return to the default scanning state.

Definition at line 40 of file b2parser.py.

Member Function Documentation

◆ ARGUMENTTUPLE()

def ARGUMENTTUPLE (   self,
  t 
)
Capture metavariable parameters by finding the matched parenthesis.

Args:
    t (sly.lex.token): token of type LPAREN

Returns:
    t (sly.lex.token): ARGUMENTTUPLE token

Definition at line 51 of file b2parser.py.

51  def ARGUMENTTUPLE(self, t):
52  """
53  Capture metavariable parameters by finding the matched parenthesis.
54 
55  Args:
56  t (sly.lex.token): token of type LPAREN
57 
58  Returns:
59  t (sly.lex.token): ARGUMENTTUPLE token
60  """
61  # Find the offset of the matching parenthesis
62  pos = findMatchedParenthesis(self.text[self.index-1:], "(", ")")
63  # Set value to slice
64  t.value = self.text[self.index-1: self.index+pos]
65 
66  self.index = self.index+pos
67  # Return to default B2Lexer state
68  self.pop_state()
69  # Return token
70  return t
71 
72 
unsigned long int findMatchedParenthesis(std::string str, char open='[', char close=']')
Returns position of the matched closing parenthesis if the first character in the given string contai...
Definition: CutHelpers.cc:33

The documentation for this class was generated from the following file: