@@ -166,6 +166,14 @@ class NCParser extends CstParser {
166
166
incrementalMode ! : ParserMethod < unknown [ ] , CstNode >
167
167
zeroSet ! : ParserMethod < unknown [ ] , CstNode >
168
168
headerEnd ! : ParserMethod < unknown [ ] , CstNode >
169
+ selectVisionTool ! : ParserMethod < unknown [ ] , CstNode >
170
+ singlePointVisionOffset ! : ParserMethod < unknown [ ] , CstNode >
171
+ multiPointVisionOffset ! : ParserMethod < unknown [ ] , CstNode >
172
+ cancelVisionOffset ! : ParserMethod < unknown [ ] , CstNode >
173
+ visionCorrectedSingleHole ! : ParserMethod < unknown [ ] , CstNode >
174
+ visionAutoCalibration ! : ParserMethod < unknown [ ] , CstNode >
175
+
176
+
169
177
170
178
constructor ( ) {
171
179
super ( multiModeLexerDefinition , {
@@ -220,6 +228,12 @@ class NCParser extends CstParser {
220
228
{ ALT : ( ) : CstNode => this . SUBRULE ( this . incrementalMode ) } ,
221
229
{ ALT : ( ) : CstNode => this . SUBRULE ( this . zeroSet ) } ,
222
230
{ ALT : ( ) : CstNode => this . SUBRULE ( this . headerEnd ) } ,
231
+ { ALT : ( ) : CstNode => this . SUBRULE ( this . selectVisionTool ) } ,
232
+ { ALT : ( ) : CstNode => this . SUBRULE ( this . singlePointVisionOffset ) } ,
233
+ { ALT : ( ) : CstNode => this . SUBRULE ( this . multiPointVisionOffset ) } ,
234
+ { ALT : ( ) : CstNode => this . SUBRULE ( this . cancelVisionOffset ) } ,
235
+ { ALT : ( ) : CstNode => this . SUBRULE ( this . visionCorrectedSingleHole ) } ,
236
+ { ALT : ( ) : CstNode => this . SUBRULE ( this . visionAutoCalibration ) } ,
223
237
224
238
] )
225
239
} )
@@ -564,9 +578,7 @@ class NCParser extends CstParser {
564
578
565
579
this . RULE ( "singlePointVisionOffset" , ( ) => {
566
580
this . CONSUME ( DefaultTokens . G35 )
567
- this . OPTION ( ( ) => {
568
- this . SUBRULE ( this . coordinate )
569
- } )
581
+ this . SUBRULE ( this . coordinate )
570
582
} )
571
583
572
584
this . RULE ( "multiPointVisionOffset" , ( ) => {
@@ -595,7 +607,7 @@ class NCParser extends CstParser {
595
607
export const parser = new NCParser ( )
596
608
export const productions : Record < string , Rule > = parser . getGAstProductions ( ) ;
597
609
598
- const GENERATEDTS = false
610
+ const GENERATEDTS = true
599
611
if ( GENERATEDTS ) {
600
612
const dtsString = generateCstDts ( productions ) ;
601
613
console . log ( dtsString )
@@ -1325,7 +1337,17 @@ export class NCToShapesVisitor extends BaseCstVisitor {
1325
1337
}
1326
1338
1327
1339
singlePointVisionOffset ( ctx : Cst . SinglePointVisionOffsetCstChildren ) : void {
1328
- if ( ctx . coordinate ) this . visit ( ctx . coordinate )
1340
+ this . state . previousX = this . state . x
1341
+ this . state . previousY = this . state . y
1342
+ const { x, y } = this . visit ( ctx . coordinate ) as PossiblePoints
1343
+ if ( this . state . coordinateMode === Constants . ABSOLUTE ) {
1344
+ if ( x !== undefined ) this . state . x = x
1345
+ if ( y !== undefined ) this . state . y = y
1346
+ } else {
1347
+ if ( x !== undefined ) this . state . x += x
1348
+ if ( y !== undefined ) this . state . y += y
1349
+ }
1350
+
1329
1351
this . result . push ( new Shapes . DatumLine ( {
1330
1352
xs : this . state . previousX ,
1331
1353
ys : this . state . previousY ,
@@ -1344,6 +1366,16 @@ export class NCToShapesVisitor extends BaseCstVisitor {
1344
1366
}
1345
1367
1346
1368
multiPointVisionOffset ( ctx : Cst . MultiPointVisionOffsetCstChildren ) : void {
1369
+ this . state . previousX = this . state . x
1370
+ this . state . previousY = this . state . y
1371
+ const { x, y } = this . visit ( ctx . coordinate ) as PossiblePoints
1372
+ if ( this . state . coordinateMode === Constants . ABSOLUTE ) {
1373
+ if ( x !== undefined ) this . state . x = x
1374
+ if ( y !== undefined ) this . state . y = y
1375
+ } else {
1376
+ if ( x !== undefined ) this . state . x += x
1377
+ if ( y !== undefined ) this . state . y += y
1378
+ }
1347
1379
if ( ctx . coordinate ) this . visit ( ctx . coordinate )
1348
1380
this . result . push ( new Shapes . DatumLine ( {
1349
1381
xs : this . state . previousX ,
@@ -1367,7 +1399,16 @@ export class NCToShapesVisitor extends BaseCstVisitor {
1367
1399
}
1368
1400
1369
1401
visionCorrectedSingleHole ( ctx : Cst . VisionCorrectedSingleHoleCstChildren ) : void {
1370
- if ( ctx . coordinate ) this . visit ( ctx . coordinate )
1402
+ this . state . previousX = this . state . x
1403
+ this . state . previousY = this . state . y
1404
+ const { x, y } = this . visit ( ctx . coordinate ) as PossiblePoints
1405
+ if ( this . state . coordinateMode === Constants . ABSOLUTE ) {
1406
+ if ( x !== undefined ) this . state . x = x
1407
+ if ( y !== undefined ) this . state . y = y
1408
+ } else {
1409
+ if ( x !== undefined ) this . state . x += x
1410
+ if ( y !== undefined ) this . state . y += y
1411
+ }
1371
1412
this . result . push ( new Shapes . DatumLine ( {
1372
1413
xs : this . state . previousX ,
1373
1414
ys : this . state . previousY ,
@@ -1386,7 +1427,16 @@ export class NCToShapesVisitor extends BaseCstVisitor {
1386
1427
}
1387
1428
1388
1429
visionAutoCalibration ( ctx : Cst . VisionAutoCalibrationCstChildren ) : void {
1389
- if ( ctx . coordinate ) this . visit ( ctx . coordinate )
1430
+ this . state . previousX = this . state . x
1431
+ this . state . previousY = this . state . y
1432
+ const { x, y } = this . visit ( ctx . coordinate ) as PossiblePoints
1433
+ if ( this . state . coordinateMode === Constants . ABSOLUTE ) {
1434
+ if ( x !== undefined ) this . state . x = x
1435
+ if ( y !== undefined ) this . state . y = y
1436
+ } else {
1437
+ if ( x !== undefined ) this . state . x += x
1438
+ if ( y !== undefined ) this . state . y += y
1439
+ }
1390
1440
this . result . push ( new Shapes . DatumLine ( {
1391
1441
xs : this . state . previousX ,
1392
1442
ys : this . state . previousY ,
0 commit comments