Skip to content

Number sign (#) breaks java highlighting #36

Open
@alexeyinkin

Description

@alexeyinkin

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions