Skip to content

Commit

Permalink
switched to salve annos and fixed dot in XML Name regex
Browse files Browse the repository at this point in the history
  • Loading branch information
raffazizzi committed Jul 27, 2020
1 parent 5eca57e commit db38aad
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,20 @@ import SalveCompletionProvider from './completion';
import 'cross-fetch/polyfill';
import * as url from 'url';
import * as path from 'path';
import {Grammar, convertRNGToPattern, DefaultNameResolver, Name} from 'salve';
import {Grammar, convertRNGToPattern, DefaultNameResolver, Name} from 'salve-annos';
import * as fileUrl from "file-url";
import { SaxesParser, SaxesTag, SaxesAttributeNS } from "saxes";
import SalveDocumentationProvider from './hover';

const ERR_VALID = 'ERR_VALID';
const ERR_WELLFORM = 'ERR_WELLFORM';
const ERR_SCHEMA = 'ERR_SCHEMA';
const NO_ERR = 'NO_ERR';

// XML Name regex (minus : and [#x10000-#xEFFFF] range)
// XML Name regex (minus : and [#x10000-#xEFFFF] range)
const nameStartChar = new RegExp(/_|[A-Z]|[a-z]|[\u00C0-\u00D6]|[\u00D8-\u00F6]|[\u00F8-\u02FF]|[\u0370-\u037D]|[\u037F-\u1FFF]|[\u200C-\u200D]|[\u2070-\u218F]|[\u2C00-\u2FEF]|[\u3001-\uD7FF]|[\uF900-\uFDCF]|[\uFDF0-\uFFFD]/);
const nameChar = new RegExp(`${nameStartChar.source}|-|.|[0-9]|\u00B7|[\u0300-\u036F]|[\u203F-\u2040]`);
const XMLname = new RegExp(`(${nameStartChar.source})(${nameChar.source})*`);
const nameChar = new RegExp(`${nameStartChar.source}|-|\\.|[0-9]|\u00B7|[\u0300-\u036F]|[\u203F-\u2040]`);
const XMLname = new RegExp(`^(${nameStartChar.source})(${nameChar.source})*$`);

export interface StoredGrammar {
rngURI?: string;
Expand Down

0 comments on commit db38aad

Please sign in to comment.