@@ -105,24 +105,29 @@ end
105105local Tokenizer = {}
106106
107107--- Abstract method that must be overridden by a concrete tokenizer.
108- --- @return string | nil
108+ --- @return string | nil The next line
109109function Tokenizer .get_next_line ()
110110 error (" This function has to be implemented!" )
111111 return nil
112112end
113113
114+ --- Checks if the parser is at the end of the line
115+ --- @return boolean If it is at the end of the line
114116function Tokenizer :eol ()
115117 return self .line :len () == 0
116118end
117119
118- --- @return boolean
120+ --- Gets the next line and checks if it exist.
121+ --- This method moves the tokenizer to the next line.
122+ --- @return boolean If the next line exists
119123function Tokenizer :has_line ()
120124 self .line = self :get_next_line ()
121125
122126 return self .line ~= nil
123127end
124128
125- --- @return string | nil
129+ --- Returns the label that is in this line
130+ --- @return string | nil The label
126131function Tokenizer :get_label ()
127132 if self .luasm .settings .label == nil then
128133 return nil
@@ -138,7 +143,8 @@ function Tokenizer:get_label()
138143 return label
139144end
140145
141- --- @return boolean
146+ --- Returns the mnemonic of the line
147+ --- @return string | nil The mnemonic that is being parsed
142148function Tokenizer :get_mnemonic ()
143149 local mnemonic , rest = self .line :match (self .luasm .settings .mnemonic )
144150
152158
153159local ArgumentTokenizer = {}
154160
161+ --- Returns the next argument based on the argument type
162+ --- @param argument_type string The argument type that should be parsed
163+ --- @return string | nil The parsed result
155164function ArgumentTokenizer :get_next (argument_type )
156165 local argument_regex = self .luasm .settings .syntax [argument_type ]
157166
@@ -164,6 +173,8 @@ function ArgumentTokenizer:get_next(argument_type)
164173 return matched
165174end
166175
176+ --- Skips the separator part of the line
177+ --- @return boolean If a separator existed
167178function ArgumentTokenizer :skip_separator ()
168179 local matched = self .line :match (self .luasm .settings .separator , self .position )
169180
@@ -176,17 +187,20 @@ function ArgumentTokenizer:skip_separator()
176187 return true
177188end
178189
190+ --- Resets the argument tokenizer
179191function ArgumentTokenizer :reset ()
180192 self .position = 1
181193end
182194
195+ --- Checks if the tokenizer is at the end of the line
196+ --- @return boolean If the end of line is reached
183197function ArgumentTokenizer :eol ()
184198 return self .position > self .line :len ()
185199end
186200
187201--- Creates an argument tokenizer based upon the current state
188202--- of the creating tokenizer.
189- ---
203+ ---
190204--- @return table The argument tokenizer
191205function Tokenizer :argument_tokenizer ()
192206 local obj = {}
0 commit comments