-
-
Notifications
You must be signed in to change notification settings - Fork 35.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
VRMLLoader: Update the token pattern for identifier to load VRML files from KiCad. #27543
Conversation
…Kicad char '-' is allowded to be used inside the identifiers for footprints in Kicad , e.g. 'PIN-01' , 'IC-LABEL-01'
http://gun.teipir.gr/VRML-amgem/spec/part1/grammar.html Id: '-'( 0x2d ) is allowed in "IdRestChars" by the VRML spec |
For testing: https://rawcdn.githack.com/Liangtie/three.js/dev/examples/webgl_loader_vrml.html We have tried implementing this some time ago but we had to revert since other VRML assets failed loading with the change. Original PR: #20321. At that time, |
I still wonder why the PR introduces the additional brackets and question mark. Why isn't it possible to treat |
…entifier for vrml" This reverts commit 11a4c67.
A minimal demo to reproduce the issue : import chevrotain from '../libs/chevrotain.module.min.js';
const createToken = chevrotain.createToken;
const RouteIdentifier = createToken( { name: 'RouteIdentifier', pattern: /[^\x30-\x39\0-\x20\x22\x27\x23\x2b\x2c\x2d\x2e\x5b\x5d\x5c\x7b\x7d][^\0-\x20\x22\x27\x23\x2b\x2c\x2d\x2e\x5b\x5d\x5c\x7b\x7d]*[\.][^\x30-\x39\0-\x20\x22\x27\x23\x2b\x2c\x2d\x2e\x5b\x5d\x5c\x7b\x7d][^\0-\x20\x22\x27\x23\x2b\x2c\x2d\x2e\x5b\x5d\x5c\x7b\x7d]*/ } );
const Identifier = createToken( { name: 'Identifier', pattern: /[^\x30-\x39\0-\x20\x22\x27\x23\x2b\x2c\x2d\x2e\x5b\x5d\x5c\x7b\x7d]([^\0-\x20\x22\x27\x23\x2b\x2c\x2d\x2e\x5b\x5d\x5c\x7b\x7d])*/, longer_alt: RouteIdentifier } );
const lexer = new chevrotain.Lexer( [ Identifier, RouteIdentifier ] );
const lexingResult = lexer.tokenize( 'PIN-01' );
console.log( lexingResult ); it will get the following output : $ node test.js
Warning: Warning: No LINE_BREAKS Found.
This Lexer has been defined to track line and column information,
But none of the Token Types can be identified as matching a line terminator.
See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#LINE_BREAKS
for details.
{
tokens: [
{
image: 'PIN',
startOffset: 0,
endOffset: 2,
startLine: 1,
endLine: 1,
startColumn: 1,
endColumn: 3,
tokenTypeIdx: 4,
tokenType: [Object]
}
],
groups: {},
errors: [
{
offset: 3,
line: 1,
column: 4,
length: 3,
message: 'unexpected character: ->-<- at offset: 3, skipped 3 characters.'
}
]
}
|
After studying #20321 again and this PR I think the situation is as follows: At the beginning, the loader was strictly developed according to the specification of http://gun.teipir.gr/VRML-amgem/spec/part1/concepts.html#SyntaxBasics. That means We have agreed to make an exception to better support KiCad (see #18298 (comment)) but #20321 failed because it removed I have verified all test files in our |
…mrdoob#27543) * fix: Update the token pattern for Identifier to load VRML files from Kicad char '-' is allowded to be used inside the identifiers for footprints in Kicad , e.g. 'PIN-01' , 'IC-LABEL-01' * style: Replace '-' with '0x2d' in the pattern matching the identifier for vrml * Revert "style: Replace '-' with '0x2d' in the pattern matching the identifier for vrml" This reverts commit 11a4c67. * Remove '0x2d' from the negation set
char '-' is allowded to be used inside the identifiers for footprints in Kicad , e.g. 'PIN-01' , 'IC-LABEL-01'
DIP-8_W8.89mm_SMDSocket.wrl.json