@@ -109,8 +109,8 @@ private function read_next_token(): ?token {
109
109
}
110
110
// A letter indicates the start of an identifier, i. e. a variable or function name.
111
111
// We also accept U+00B5 (MICRO SIGN), U+03BC (GREEK SMALL MU), U+2126 (OHM) and
112
- // U+03A9 (GREEK CAPITAL OMEGA) for units.
113
- if (preg_match ('/[_A-Za-z\x{00B5}\x{03BC}\x{03A9}\x{2126}]/u ' , $ currentchar )) {
112
+ // U+03A9 (GREEK CAPITAL OMEGA) for units. And we allow the degree symbol ° as well.
113
+ if (preg_match ('/[_A-Za-z° \x{00B5}\x{03BC}\x{03A9}\x{2126}]/u ' , $ currentchar )) {
114
114
return $ this ->read_identifier ();
115
115
}
116
116
// Unless we are in the middle of a ternary operator, we treat : as a RANGE_SEPARATOR.
@@ -426,10 +426,11 @@ private function read_identifier(): token {
426
426
while ($ currentchar !== input_stream::EOF ) {
427
427
$ nextchar = $ this ->inputstream ->peek ();
428
428
// Identifiers may contain letters, digits or underscores. Also, we will accept the
429
- // µ and Ω symbols, because they may appear in units. We don't want to throw lexing
430
- // errors while reading them. Note that we explicitly include U+00B5 (MICRO SIGN),
431
- // U+03BC (GREEK SMALL MU), U+2126 (OHM) and U+03A9 (GREEK CAPITAL OMEGA).
432
- if (!preg_match ('/[A-Za-z0-9_\x{00B5}\x{03BC}\x{03A9}\x{2126}]/u ' , $ nextchar )) {
429
+ // µ and Ω symbols, because they may appear in units. The same is true for the degree °
430
+ // symbol. We don't want to throw lexing errors while reading them. Note that we
431
+ // explicitly include U+00B5 (MICRO SIGN), U+03BC (GREEK SMALL MU), U+2126 (OHM) and
432
+ // U+03A9 (GREEK CAPITAL OMEGA).
433
+ if (!preg_match ('/[A-Za-z°0-9_\x{00B5}\x{03BC}\x{03A9}\x{2126}]/u ' , $ nextchar )) {
433
434
break ;
434
435
}
435
436
$ currentchar = $ this ->inputstream ->read ();
0 commit comments