Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 1 addition & 10 deletions src/__tests__/mode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ test('constants are not correctly loaded', () => {
})

test('operator syntax type error', () => {
const code = 'const num = 3; \nnum++; \nnum--; \nnum += 1; \n5 + num |2;'
const code = 'const num = 3; \nnum++; \nnum--; \nnum += 1;'

setSession(Chapter.SOURCE_1, defaultVariant, defaultExternal, code)

Expand All @@ -91,15 +91,6 @@ test('operator syntax type error', () => {

const token3 = session.getTokenAt(3, 5)
expect(expectedBool(token3, CATEGORY.forbidden)).toBe(true)

const token4 = session.getTokenAt(4, 1)
expect(expectedBool(token4, CATEGORY.number)).toBe(true)

const token5 = session.getTokenAt(4, 9)
expect(expectedBool(token5, CATEGORY.forbidden)).toBe(true)

const token6 = session.getTokenAt(4, 10)
expect(expectedBool(token6, CATEGORY.number)).toBe(true)
})

test('forbidden keywords', () => {
Expand Down
4 changes: 2 additions & 2 deletions src/editors/ace/modes/source.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,9 @@ export function HighlightRulesSelector(
const VariantForbiddenRegexSelector = () => {
if (variant === Variant.TYPED) {
// Removes the part of the regex that highlights singular |, since Typed variant uses union types
return /\.{3}|--+|\+\++|\^|(==|!=)[^=]|[$%&*+\-~\/^]=+|(?<!&)&(?!&)/
return /\.{3}|--+|\+\++|\^|(==|!=)[^=]|[$%&*+\-~\/^]=+|[^&]*&[^&]/
}
return /\.{3}|--+|\+\++|\^|(==|!=)[^=]|[$%&*+\-~\/^]=+|(?<!&)&(?!&)|(?<!\|)\|(?!\|)/
return /\.{3}|--+|\+\++|\^|(==|!=)[^=]|[$%&*+\-~\/^]=+|[^&]*&[^&]|[^\|]*\|[^\|]/
}

// @ts-ignore
Expand Down
Loading