Skip to content

Commit

Permalink
feat(developer): hint/warn on range check 🙀
Browse files Browse the repository at this point in the history
- failing test

#10316
  • Loading branch information
srl295 committed Feb 2, 2024
1 parent 535418d commit db1c4b8
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
9 changes: 9 additions & 0 deletions developer/src/kmc-ldml/src/compiler/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,15 @@ export class CompilerMessages {
static Error_IllegalCharacters = (o: { count: number, lowestCh: number }) =>
m(this.ERROR_IllegalCharacters, `File contains ${o.count} illegal character(s), including ${util.describeCodepoint(o.lowestCh)}`);
static ERROR_IllegalCharacters = SevError | 0x0025;

static Hint_CharClassImplicitDenorm = (o: { lowestCh: number }) =>
m(this.HINT_CharClassImplicitDenorm, `File has character classes which span non-NFD character(s), including ${util.describeCodepoint(o.lowestCh)}. These will not match any text.`);
static HINT_CharClassImplicitDenorm = SevHint | 0x0023;

static Warn_CharClassExplicitDenorm = (o: { lowestCh: number }) =>
m(this.WARN_CharClassExplicitDenorm, `File has character classes which include non-NFD characters(s), including ${util.describeCodepoint(o.lowestCh)}. These will not match any text.`);
static WARN_CharClassExplicitDenorm = SevWarn | 0x0024;

}


18 changes: 18 additions & 0 deletions developer/src/kmc-ldml/test/test-tran.ts
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,24 @@ describe('tran', function () {
assert.strictEqual(transforms[0].to.value, "x");
}
},
{
subpath: 'sections/tran/tran-warn-range.xml',
warnings: [
CompilerMessages.Warn_CharClassExplicitDenorm({lowestCh: 0}),
],
},
{
subpath: 'sections/tran/tran-hint-range.xml',
warnings: [
CompilerMessages.Hint_CharClassImplicitDenorm({lowestCh: 0}),
],
},
{
subpath: 'sections/tran/tran-hint-range2.xml',
warnings: [
CompilerMessages.Hint_CharClassImplicitDenorm({lowestCh: 0}),
],
},
], tranDependencies);
});

Expand Down

0 comments on commit db1c4b8

Please sign in to comment.