highlight.dart
highlight.dart copied to clipboard
Number sign (#) breaks java highlighting
For this input:
class MyClass {
}
we get the correct result:
Add a number sign:
class MyClass {
}#
and nothing is parsed:
Note that language is also null
although java
is explicitly passed.
Code
import 'package:highlight/highlight_core.dart';
import 'package:highlight/languages/java.dart';
void main() {
highlight.registerLanguage('java', java);
const text = '''
class MyClass {
}
''';
final result = highlight.parse(text, language: 'java');
print(result.nodes);
const textNumber = '''
class MyClass {
}#
''';
final resultNumber = highlight.parse(textNumber, language: 'java');
print(resultNumber.nodes);
}
Output
[Instance of 'Node', Instance of 'Node', Instance of 'Node']
[Instance of 'Node']