const hljs = require('../../build');
describe("parser specifics", function () {
describe("a grammar with look-ahead end matchers", () => {
it("should match successfully", () => {
hljs.registerLanguage('test-language', (hljs) => {
const PATTERN = {
className: "pattern",
begin: '[A-Z]{3}',
end: '\\d{3}(?=\\s+)'
}
return {
contains: [PATTERN]
};
});
hljs.highlight('ABC123 is the secret. XYZ123. End of string: ABC123', {language: 'test-language'}).value
.should.equal(
'<span class="hljs-pattern">ABC123</span> is the secret. <span class="hljs-pattern">XYZ123. End of string: ABC123</span>'
)
})
})
})