@@ -316,8 +316,8 @@ class PickleTokenizer {
316
316
return this . makeToken ( "string.block" , lines . join ( "\n" ) ) ;
317
317
}
318
318
const TOKEN_REGEXES = [
319
- { type : "comment.block" , re : / ^ (?< ! # ) ( # # # + ) (? ! # ) [ \s \S \n \r ] * ?(?< ! # ) \1(? ! # ) / , significant : false } ,
320
- { type : "comment.line" , re : / ^ # [ ^ \n ] * / , significant : false } ,
319
+ { type : "comment.block" , re : / ^ (?< ! # ) ( # # # \S * ? # # # ) (? ! # ) [ \s \S \n \r ] * ?(?< ! # ) \1(? ! # ) / , significant : false } ,
320
+ { type : "comment.line" , re : / ^ # # [ ^ \n ] * / , significant : false } ,
321
321
{ type : "paren" , re : / ^ [ \( \) \[ \] ] / , significant : true , groupNum : 0 } ,
322
322
{ type : "space" , re : / ^ (? ! \n ) \s + / , significant : false } ,
323
323
{ type : "eol" , re : / ^ [ ; \n ] + / , significant : true , groupNum : 0 } ,
@@ -327,7 +327,7 @@ class PickleTokenizer {
327
327
{ type : "number.integer" , re : / ^ - ? ( [ 1 - 9 ] [ 0 - 9 ] * | 0 x [ 0 - 9 a - f ] + | 0 b [ 0 1 ] + ) / i, significant : true , groupNum : 0 } ,
328
328
{ type : "number.float" , re : / ^ - ? [ 0 - 9 ] + ( \. [ 0 - 9 ] + ) ? ( e [ + - ] \d + ) ? / i, significant : true , groupNum : 0 } ,
329
329
{ type : "symbol" , re : / ^ [ a - z _ ] [ a - z 0 -
8000
9 _ ] * \? ? / i, significant : true , groupNum : 0 } ,
330
- { type : "symbol.operator" , re : / ^ [ - ~ ` ! @ $ % ^ & * _ + = [ \] | \\ : < > , . ? / ] + / , significant : true , groupNum : 0 } ,
330
+ { type : "symbol.operator" , re : / ^ [ - ~ ` ! @ # $ % ^ & * _ + = [ \] | \\ : < > , . ? / ] + / , significant : true , groupNum : 0 } ,
331
331
]
332
332
for ( var { type, re, significant, groupNum } of TOKEN_REGEXES ) {
333
333
console . debug ( "trying" , type ) ;
@@ -412,6 +412,9 @@ class PickleObject {
412
412
*/
413
413
this . source = null ;
414
414
}
415
+ get typeName ( ) {
416
+ return this . constructor . typeName ;
417
+ }
415
418
/**
416
419
* Returns the method resolution order for this object's prototype chain.
417
420
* @returns {PickleObject[] }
@@ -450,6 +453,17 @@ class PickleObject {
450
453
setProperty ( pname , value ) {
451
454
throw 'todo' ;
452
455
}
456
+ /**
457
+ * Call the object with the specified parameters.
458
+ * @param {PickleCollection } args
459
+ * @param {PickleScope } scope
460
+ * @param {PickleObject? } thisArg
461
+ * @returns {PickleObject }
462
+ */
463
+ call ( args , scope , thisArg = this ) {
464
+ if ( args . length > 0 ) throw new PickleError ( `can't call ${ this . typeName } ` ) ;
465
+ return thisArg ;
466
+ }
453
467
}
454
468
455
469
class PickleSymbol extends PickleObject {
@@ -707,6 +721,46 @@ class PickleExpando extends PickleInternalObject {
707
721
}
708
722
}
709
723
724
+ class PickleBoundProperty extends PickleInternalObject {
725
+ static typeName = "bound_property_or_function" ;
726
+ /**
727
+ * @param {PickleObject } thisArg The object bound to
8000
span>
728
+ * @param {PickleSymbol } property The property key
729
+ * @param {...PickleObject } prototypes
730
+ */
731
+ constructor ( thisArg , property , ...prototypes ) {
732
+ super ( ...prototypes ) ;
733
+ /**
734
+ * @type {PickleObject }
735
+ */
736
+ this . thisArg = thisArg ;
737
+ /**
738
+ * @type {PickleSymbol }
739
+ */
740
+ this . property = property ;
741
+ }
742
+ }
743
+
744
+ class PicklePropertySetter extends PickleInternalObject {
745
+ static typeName = "setter" ;
746
+ /**
747
+ * @param {PickleSymbol } property The property key
748
+ * @param {PickleObject } value The value to set to
749
+ * @param {...PickleObject }
989A
prototypes
750
+ */
751
+ constructor ( property , value , ...prototypes ) {
752
+ super ( ...prototypes ) ;
753
+ /**
754
+ * @type {PickleSymbol }
755
+ */
756
+ this . property = property ;
757
+ /**
758
+ * @type {PickleObject }
759
+ */
760
+ this . value = value ;
761
+ }
762
+ }
763
+
710
764
/**
711
765
* An object that parses Pickle code into an abstract syntax tree.
712
766
*/
0 commit comments