highlight.dart icon indicating copy to clipboard operation
highlight.dart copied to clipboard

Number sign (#) breaks java highlighting

Open alexeyinkin opened this issue 2 years ago • 0 comments

For this input:

class MyClass {
}

we get the correct result:

image

Add a number sign:

class MyClass {
}#

and nothing is parsed:

image

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']

alexeyinkin avatar Aug 03 '22 10:08 alexeyinkin