SMETParser Class
A SMET Weather Station Meteorological Data Format parser. Reads the input by line in a single pass (supports streamed data).
Constructor
SMETParser
()
Item Index
Methods
Methods
check
(
Boolean
-
against
Returns true if the next line starts with the
given string
against
.
Parameters:
-
against
String
Returns:
end
()
chainable
This method must be called by the parsing methods
when the parsing has finished.
generate_meta
()
private
chainable
next
()
String | Undefined
Returns the next line/token; updates the parser's current
position pointer and line number as a side effect.
Returns:
String | Undefined:
The next token.
parse
(
Object
-
[callback]
Starts the parsing process; in sync mode this
method blocks until the parsing has finished,
otherwise it should return immediately!
If given a callback, it must be bound to the
end
and error
events.
Parameters:
-
[callback]
Function optional
Returns:
Object:
The parse result.
parse_line
(
private
-
line
Lexically analyses a line and parses it accordingly.
Note: When strict parsing is active (default), this method will reject out-of-section lines even if they are syntactically correct (e.g., header definitions outside of a header section).
Parameters:
-
line
String
pause
()
Resumes _parse method after a short timeout; these
small timeouts effectively give the browser more time
to breathe and are a remedy for the 'long running script'
warnings in Firefox.
restrict
()
skip
(
String | Undefined
-
over
-
[until]
Like
next()
but skips lines matching over
until the end of data is reached or, if given,
the next line starts with until
.
Returns:
String | Undefined:
The next line.
verify
()
Properties
_parse
Unknown
dates
ArrayA list of date/time formats recognized by the parser.
fields
Arrayfields
ArrayA list of all known fields. For each field,
there is a corresponding parser/converter
in .converters
.
mode
String
The current parsing mode. The mode corresponds to the different sections in a SMET file:
- 'signature'
- 'header'
- 'data'
trim
String
The token trim value; defaults to a carriage
return. If present, this value will be cut off
at the end of each token during parsing.