-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathnotes
2629 lines (2004 loc) · 53.7 KB
/
notes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
move c past whitespaces
if it doesn't start with /*
if char===';' skip rest of line
string:
if ", and if next c+1 < length, if c+1==='"'
FUNCTION:
get alphaNum, if not a number like 123(), it's a function.
finding a *.d.ts bundler (typescript declaration files):
tried (didn't wor):
ts-loader: declaration-bundler-webpack-plugin
https://github.com/TypeStrong/ts-loader#declarations-dts
https://www.npmjs.com/package/declaration-bundler-webpack-plugin
dts-bundle-generator:
Project seems dead. dts-bundle-generator looks like an alternative. #83
https://github.com/TypeStrong/dts-bundle/issues/83
https://github.com/timocov/dts-bundle-generator
dts-bundle worked:
https://github.com/TypeStrong/dts-bundle
src -> src/parser/ and src/usage.ts
because I don't want usage.ts to be bundled.
webpack.config.js -> build\webpack.config.js with build\dtsBundle.js & build\unlink_d.ts.js
`yarn declarations`(tsc --emitDeclarationOnly) isn't needed because `yarn webpackProd` somehow produces the declaration files...
note the "include": ["src/parser/**/*.ts"], (in tsconfig.json) `yarn webpackProd` somehow respects that
removed sourcemaps (I don't think I need sourcemap in prod):
(idk what options do) https://webpack.js.org/configuration/devtool/
removed:
(package.json) webpack --devtool hidden-source-map
(webpack.config.js) // devtool: 'nosources-source-map',
(webpack.config.js)
//https://webpack.js.org/guides/author-libraries/#expose-the-library
library: {
name: 'ahkParser',
type: 'umd',
},
idk what library.name does, but I'm using camelCase because the example is `library: "webpackNumbers",`
it seems that it's used in script tag
<script>
window.webpackNumbers.wordToNum('Five');
</script>
what if I only want the .js and NOT the .d.ts
just like lodash and @types/lodash, I put @types/ahk_parser.js in /types/package.json
notice that ahk_parser.js & @types/ahk_parser.js are in the same repo, but they won't be when published, because
package.json: files: [only takes index.js], and /types/ will be it's own npm package
how to use locally:
yarn add link:../ahk_parser.js
yarn add -D link:../ahk_parser.js/types
from npm package registry: idk yet
REORGANIZED
while (c < numCharsMinusOne) {
if (whiteSpaceObj[lines[i][c]]) {
c++
continue
} else if (lines[i].slice(c, c + 2) === '*/') {
everything.push({type: 'MultilineComment', lineStart: multiLineCommentLineStart, colStart: multiLineCommentColStart, lineEnd: i, colEnd:c + 2})
// d('MultilineComment END', l())
i++
break outer2
}
break
}
->
//skip through whiteSpaces
while (c < numCharsMinusOne && whiteSpaceObj[lines[i][c]]) {
c++
}
//if line starts with */
if (lines[i].slice(c, c + 2) === '*/') {
everything.push({type: 'MultilineComment', lineStart: multiLineCommentLineStart, colStart: multiLineCommentColStart, lineEnd: i, colEnd:c + 2})
// d('MultilineComment END', l())
break
}
a line can start with:
HOTKEY:
$^+left::
can this be a var ?
$
yes
#NoEnv
yes, but you can't assign it like this #NoEnv :=4, you can't have a space
#include
same
#if
same
#ANYDirective
same
#
fine variable, # :=3, still works as a var
return
fine variable, return :=3
if
yes, but if :=, becomes an if statement? (not confirmed)
for
fine variable, for :=3, still works as a var, what a surprise
ExitApp
fine variable, ExitApp :=3
#NoEnv is actually just a statement just like Send, ignore the # if it helps
when is it incorrect to skip spaces ?
I shouldn't skip spaces for:
function definition
#Include though
NO SPACE: ASSIGNMENT
#NoEnv:=2
SPACE: STATEMENT
#NoEnv :=2
check if assignment
skip spaces
check if statement, else assignment
continue Trie: IT, will tell if assignment or statement ?
if not found in Trie: oof ?
so lets fill our Trie with
:=
#NoEnv
and setup a test
oh I cannot, it only does the variable name
I can use 2 Trie
if statement:
if space:
isSTATEMENT
if end of line:
isSTATEMENT
if comma:
isSTATEMENT
else:
is FUNCTION CALL ?
is FUNCTION DEFINITION ?
is assignment ?
if undefined:
is FUNCTION CALL ?
is FUNCTION DEFINITION ?
is assignment ?
ok, it's the same pattern, good
but now, the end of trie, doesn't HAVE to be a function anymore, it can just be the TYPE
'statement'
instead of an object
{}
in fact, this trie can be a trie of ONLY statements. what else can there be ? hOtKeys...
#k::
ok fiouf, hotkeys can only be one CHAR
so
#if::
is impossible, I'M SPARED
omg
if :=2
this become an ACTUAL "if statement" (not confirmed)
not every statement becomes a statement if SPACE
for ex: "for :=2" is a fine variable.
if SpaceStatement:
if space:
isSTATEMENT
if end of line:
isSTATEMENT
if comma:
isSTATEMENT
else:
is FUNCTION CALL ?
is FUNCTION DEFINITION ?
is assignment ?
if WeakStatement:
if end of line:
isSTATEMENT
if comma:
HMMMMMMMMM
for, doesn't work: FOR IS A CONTROL STATEMENT: which works with { block }
isSTATEMENT
else:
is FUNCTION CALL ?
is FUNCTION DEFINITION ?
is assignment ?
if undefined:
is FUNCTION CALL ?
is FUNCTION DEFINITION ?
is assignment ?
if trie ends at Control, it can't continue to ControlClick
dump trie, use if (object['control']=="SpaceStatement")
PLEASE, just write, REORDER AFTER
if FUNCTION:
if SpaceStatement:
if space:
if end of line:
if comma:
isSTATEMENT
skipSpaces
if ASSIGNMENT:
else:
???
it's control.directives, not statement: from ahk.tmLanguage.json
allowsamelinecomments|clipboardtimeout|commentflag|errorstdout|escapechar|hotkeyinterval|hotkeymodifiertimeout|hotstring|if|iftimeout|ifwinactive|ifwinexist|ifwinnotactive|ifwinnotexist|inputlevel|installkeybdhook|installmousehook|keyhistory|ltrim|maxhotkeysperinterval|maxmem|maxthreads|maxthreadsbuffer|maxthreadsperhotkey|menumaskkey|noenv|notrayicon|persistent|singleinstance|usehook|warn|winactivateforce
they're called #Directives in https://www.autohotkey.com/docs/commands/index.htm
and ControlClick is a Command
\ahk_parser.js\ahk_language\flow of control\is if assign an actual if\test38.ahk
;yes, `if :=4` is an actual if statement
oof.
LABELS:
if:
global, local, static
hotkey
ImageListID%A_Index% := IL_Create(50)
METHOD CALL:
LV_Colors.Cell(ListviewHwnd%whichSide%,row,3,color)
let's deal with METHOD CALL First.
now the question is: variable assignment first, or labels and hotkeys ?
var assignment: char==="%" or validChar[char]
well, it's now or never to be a label: because label can't have %
this is NOT a label
$enter::
$enter: ;this is a label
so:
skip whiteSpaces
if EOL or semiColonComment
it's a label
let's do varName first, hotkeys have more special chars
varName can be assignment, function, method.
COMMAND EOL:
break
return
Exitapp
ToolTip
else
global
Else
Return
continue
#Persistent
looks good to me
.\found\COMMAND comma\unique: looks good to me
whiteSpace DIRECTIVE:
#NoEnv
#KeyHistory
#include
#if
good
if statement: too many but is working fine
global local or static: works
.\found\FUNCTION CALL OR DEFINITION\unique: seems good now
this is NOT a METHOD call:
str.=v[key] "+" k "|"
so check if the next character is a valid Var
.\found\METHOD OR PROPERTY\unique: good now
fixed //#LABELS with c++: need to advance it
.\found\LABEL EOL\unique: looks fine
LABEL SemiColonComment: not found but tested and works:
gsaveSettings: ;labels
gsaveSettings: LABEL SemiColonComment 16 line 161
.\found\HOTKEY validVarName\unique: GOOD
var can have space between assignment
var .=
but hotkey can also, oh god
LShift & RCtrl::
Ralt & m::
fiouf label can't have spaces
label :
so I am both here and here
.=
& RCtrl::
skip spaces
if assignment operator:
ok
skip spaces OR HOTKEY stuff: &^#$ (this risks skipping everything, must limit it to line)
if ==='::'
ok
.\found\2 char assignment operator\unique: good
invalid hotkey:
msgboxx,::msgbox, 4
good msgbox:
msgbox,::msgbox, 4
so I must check if it's a valid command
or I can do, if invalid hotkey: it's a command ?
so now I need to know WHICH COMMANDS will be a command when:
COMMAND,::
COMMAND ::
I need to be REALLY careful because there are command like FileRecycleEmpty: Empties the recycle bin.
I will do one thing for now: COMMAND comma test
ima test SOME.
hotkeys can have commands:
f3::Exitapp
so no, hotkeys don't end with ::
all this is validVarName:
whiteSpace directive
virtual skip whiteSpaces:
variable assignment
whiteSpace directive OR Command
hotkey
well, if there was no whiteSpace, it has NO CHANCE. of being anything
so let's start there
whiteSpace:
directive?
skip spaces:
validVarName assignment ?
Command?
hotkey
whiteSpace DIRECTIVE; validVar assignment; whiteSpace COMMAND
why isn't this being caught as hotkey ?
; invalid hotkey
msgbox%::msgbox, 4
skip ONLY if c==0
fixed
`;:: works because currently if it start with ';' it's a comment
AND ONLY if it start with it. so:
command ;fefef
wouldn't be detected
now let's do assign:
var:=expression:
ok:=foo:=2 + bar:=4
p(ok) ;6
expression can be:
unit:
var:var
func: Substr(), Map()
number:123
string:"123"
object literal:{ok:45,"?":3}:
{string|prop : expression}
array:[1,2,3,"3"]:
[expression]
decimal numbers are not method calls, because they are not validVarName 123.34() : 123 is not validVarName
so, if . and number: it's DECIMAL, or float..
Integer, Float, %Var%
if one validVarName:
skip until not validVarName
if (:
Func
else if .
if Number:
DECIMAL
else:
method or prop
else:
var
//#unit
skip whiteSpaces
if EOL OR ;
Continuation stuff
if % or validVarName
skip until not validVarName
EOL:
isNotNumber:
valid var
else:
Integer
if .
if Number:
DECIMAL
else:
method or prop
skip until not % OR validVarName
EOL:
%VAR% : can't be integer
if (:
Func
if .
method or prop
else:
isNotNumber:
var
else:
Integer
else if "
else if ( paren for ternary or order of operations
else if [ array literal
else if { object literal
else:
???
oh no, it can be an array accessor.
var[2]
valid is a subgroup of % or valid
nonoononononono
var:= CmdLine := ( A_IsCompiled ? "" : """" A_AhkPath """" )
now let's do string concat expression ?
I need to understand how operators work because whiteSpace is an operator.
concat operator, when there are no other operators
so, I'll start with +
var + var
after I found a var, I check if there's an operator.
better check for assignment first, += before +
what about whiteSpace?
+
a
operator AND whiteSpace
operator WITHOUT whiteSpace
concat AND whiteSpace
skip whiteSpaces
if EOL, return
check if assignment
check if operator
check if whiteSpace[lines[i][c - 1]]
OR
check if whiteSpace[lines[i][c - 1]]:
skip whiteSpaces
if operator:
operator
if assignment:
assignment
else:
concat
if operator:
if assignment:
ok I'll choose the first one
comparison operators ARE operators
assignment operators are also operators...
oh, NOT, AND, OR, are reserved, they can't be variables.
I'll do paren now:
( expression )
assignment CAN be EOL, so expect multilineParenExpr
var:=
(
"abc" foo
)
THIS DOESN'T CONCAT
var:=
(
"abc" foo{WHITESPACE}
)
(
"abc" foo
)
BUT THIS DOES
var:=
(
"abc" foo
)
(
{WHITESPACE}"abc" foo
)
I should read this https://www.autohotkey.com/docs/Scripts.htm#continuation
The default behavior of a continuation section can be overridden
by including one or more of the following options to the right
of the section's opening parenthesis.
If more than one option is present,
separate each one from the previous with a space.
For example: ( LTrim Join| %.
omg, so it's like a statement...
you are an expression, you do not know that you are inside
a continuation sequence, you don't care
your caller function knows.
what's the entry point ?
string EOL expect continuation
expression EOL expect continuation
only if not already inside continuation
my understanding is that when in continuation mode,
strings can go multiline
usually skipThroughEmptyLines() takes care of ; comments
but I don't want in continuation section, PLUS they are illegal
multiline comment in continuation?
no you can't, I'm saved.
oh cool, you can't have trailing comma on arrays
LEGAL
var1:=[1,"2"]
ILLEGAL
var1:=[1,"2",]
findPercentVar()
if (validVar)
try to be linear as possible..
now, function calls
how do I know if function call or definition?
foo(arg1, Byref arg2:=3) {
}
foo(arg1, Byref arg2:=3)
{
}
foo([1,2,3],34)
this is illegal, cool
foo(arg1, Byref arg2:=3+3) {
:=number, string, bool
added exprFoundLine=-1, exprFoundLine=i first thing called by betweenExpression()
foo:="bar"
var2:={"4" foo:3 +3}
p(var2) ;4bar:6
var2:={foo:3 +3}
p(var2) ;foo:6
var2:={foo "4":3 +3}
p(var2) ;bar4:6
var2:={foo foo:3 +3}
p(var2) ;barbar:6
obj literal is dyn as long as it's not a single var
so if there's at least one betweenExpression
var2:={condition ? ifTrue : ifFalse : value}
p(var2)
2 implementations possible:
count how many ?
and if questionMarkCount
':' ends a ternary
OR
remove : from operators
when you see a ?, expect a :
this one is less recursive, but I'm more
comfortable with recursion ?
var:ok?no
1st would see :, and say, illegal
and do what ?
2nd: would not see it. and the line continues
because nothing found.
so 1st could see :, and continue line ?
knowing how deep probably is helpful
if 1operator === '?'
but it would say illegal when it sees
: of an object...
so let's just go with 2nd, expect a :
now that : isn't operator, it's concat...
I need to c++ after : , but still some concat
fixed concat, which is printed after because it needs to know if what's after is Expr
keep track of should there be a colon using colonDeep++ when obj or '?'
now how to check if obj key is single var or more? not now, it's not my buisness
keep track of an array?, always add to the newest and remove when done?
no, let's do functions
func definition:
validVar
findBetween
,
)
}
a strategy could be: find next ) , may be in another line oof
c++
skipThroughEmptyLines()
if lines[i][c]==='{'
come back
return true
else
come back
return false
if isFunctionDefinition() {
} else {
enter function call
}
I don't want lineLoop to do c=0
I need lineLoop to be a function because I
want to know when it ends. to wrap } ?
{ lineLoop
}
I could just look for starting } in lineLoop
oh, what about func in func ?
Functions cannot contain functions,
the program will exit
lineLoop, which does c=0
and startOfLineLoop, which does nothing
I need to make sure any continue/break becomes continue lineLoop
here's how to use it:
usingStartOfLineLoop = true
skipThroughWhiteSpaces()
continue startOfLineLoop
skipThroughEmptyLines skip ; at start of line c === 0 || whiteSpaceObj[lines[i][c - 1]]
1 AND (2 OR 3) instead of (1 AND 2) OR 3
lets start methods
https://www.autohotkey.com/docs/Concepts.htm#names
# @ $
LEGAL:
var2:=a.b.c
[betweenExpression]var3:=2
ILLEGAL:
var1:=a.b.c [betweenExpression])ger
var3:=2
why does [betweenExpression] end ?
insideContinuation is false
findBetween is false
insideContinuation is false
so it skipped lines until find something
if something is a between, check
if blocked by invalid, I can flag invalid
if blocked by valid, oof
then I should check if still on the same line
I mean, on the same line as last found: exprFoundLine
now let's do arr/map access
I think it's like a group.
then do decimal numbers
then turn continuation into an operator
d(`${validName} assignment`)
I don't need the i++ because it skips lines
when stringContinuation Ends, what does it do?
it will try to find end of string, if it can't, then return false
but its return value is ignored
findDoubleQuotedString() will return true
after betweenExpression(), ch() === '"'
I think it will expect another continuation section
no, it doesn't
I will make it do so.
if not inside and endStringContinuation returns false
normally, when endStringContinuation returns false
insideContinuation = false
Ended and didn't find end of string
start a new continuation section
finds illegal char
then findDoubleQuotedString should return false
no still return true but skipThroughEmptyLines()
maybe I need more abstract thinking
after )END METHOD, it will betweenExpression
I must reorganize my code now..
what's the difference between betweenExpression() AND findBetween()
findDoubleQuotedString() is hard to understand
delimArr.ignoreTimes[index]-=1
property, property->ArrAccess can be followed by betweenExpression()
first
a.b-=1
if (!findMethodOrProperty()) {
d('illegal property on startOfLine',char())
}
// true if method, false if prop
illegal property on startOfLine
ONLY if no betweenExpression()
in betweenExpression(): if findBetween(), return true
betweenExpression() will skipLines, so no need i++
return Expression
I don't want return Expr to be recognized as concat
why does findExprMatch the one on the next line ?
oof
skipThroughEmptyLines will skip through and go to the other return
statement can't have Expr if line changed...
// can't be betweenExpression() because whiteSpace := takes priority
why does ; return {1:2,"1":5} loop forever when 2 is fine ?
Integer:
betweenExpression()
return true
vs
d('} object', char())
colonDeep--, c++
return true
adding betweenExpression fixes it lol
inBetweens*
in
string_getUntilWithInBetweensULTRA(Byref string, Byref getUntil, inBetweens*) {
is this legal ?
a(b,inBetweens *) {
}
YES IT IS
use variadicAsterisk = false
in string_getUntilWithInBetweensULTRA:
valid empty arr 19 line 2
] end 19 line 2
for idkVariable 8 line 4
concat error only if indented
let's go in betweenExpression()
concat ONLY if i === lineBeforeSkip
#TODO
return
+2
is LEGAL, but it's NOT
an assignment
] ArrAccess 41 line 11
)END METHOD 42 line 11
illegal property on startOfLine 17 line 12
endDelims.Push METHOD 31 line 12
//a method can actually be assigned... property too
//if prop and no assignment
illegal property on startOfLine
delimArr.ignoreTimes Array/Map Access 53 line 44
[ ArrAccess 53 line 44
index idkVariable 59 line 44
] ArrAccess 59 line 44
ILLEGAL nonWhiteSpace '-' at findCommentsAndEndLine 60 line 44
} Function DEFINITION 29 line 45
if (!betweenExpression() && isProp) {
instead of
if (isProp && !betweenExpression()) {
because short-circuit
now I want to convert object to Map()
works, cool, now need quotes for singleVar
can Map keys be numbers ? YES
which chars are allowed as string key ? in v1
12 is a number, it's != "12":value
ahk_language\string keys chars allowed in obj.ahk
so it's propCharsObj in tokens.ts
skipSpaces
skip though propCharsObj
if found expression:
(another propCharsObj or anything)
it not NOT a singleVar anymore
if haven't expression, it is only illegal if haventFoundSingleVar, which is a valid key
NO, it doesn't work for obj in obj
omg, and thinking about arr in arr
we'll have to construct it with pieces, let's play legos
when in object, don't push to everything,
push to THAT corresponding object
or I could just modify it directly and advance c and i
easy method
no, always do it the hard way
do not everything.push when Searching for function definition
do not skipThroughWhiteSpaces() when skipThroughFindChar(')')
do not skipThroughWhiteSpaces() when skipThroughEmptyLines()
validName needs to first check if there WAS an assignment operator
before saying that YES, this was an assignment
so instead of push, splice so that it is second last
I also need to save these positions
const validNameEnd = c,validNameLine = i
'end of lineLoop' never happens
findCommentsAndEndLine() after '} function definition'
isFunctionDefinition() use it's own version of skipThroughEmptyLines()
without everything.push()
somehow for is skipped and skipThroughEmptyLines() is catching what's between for and index. is IS working correctly.
for index
so it's checking for whiteSpace assignment
if found assignment, it needs to keep the whiteSpaces found, it's inserting at 2nd last
but we don't want the whiteSpace between for and ... do we ?. do we ?
we do
the indent is doubled:
endDelims := []
becomes
endDelims := []
after 'emptyLines', there shouldn't be 'whiteSpaces'
when this happens, I'm sure it's because lineLoop is called which does c=0
we want startOfLineLoop instead
let's just copy what we have from 'assignment' to 'assignment whiteSpace'
works
concat "" 0LENGHT 7 line 7
concat " " 1LENGHT 12 line 9
concat "" 0LENGHT 9 line 9
ILLEGAL nonWhiteSpace ',' at findCommentsAndEndLine 18 line 9
shouldn't concat when it's on different lines
betweenExpression() shouldn't set lineBeforeSkip = i
because it doesn't know.
well I can rename lineBeforeSkip to lineWhereCanConcat
but now I get
ILLEGAL nonWhiteSpace 'i' at findCommentsAndEndLine 13 line 9
13 line 9: it's before 'index'
for index, delimArr in inBetweens {
for is 'command', that's good
findCommentsAndEndLine() should NOT be called on the line of 'for'
when 'command', a line should've been skipped, trace() to see which one came first
if (i === 3) {
d(345345)
trace()
}
'command' came first
NO, I got the wrong for, this is the right one:
{type:'idkVariable', text:'for', i1:8, c1:8, c2:11},
for should NOT be idkVariable
if (!betweenExpression()) { findExpression() }
WHY was this called ?
{type:'] Array', text:']', i1:7, c1:24},
why after '] Array', it went to line 134?
well, no, it was line 134 that called findExpression that simplify returned, so it came back
that's fine
{type:'emptyLines' i2:8
then what called this ?
it was probably called by findExpression() at 'for'
it seems that this hhas been called twice
omg it IS called twice, WHYYYYYY : line 139..
I forgot to remove the og findExpression() when pasting from 'assignment' to 'assignment whiteSpace'
endDelims.Push(delim[2])
becomes
endDelims.Push(delim[2])
indentation doubled again..
everything.push({type: ') method', text:')',i1: i, c1:c})
if (i === 11) {
trace()
}
line 340
i === exprFoundLine needs to be true I think
let's try
if (i === exprFoundLine || i === 12) {
NO, it's this it needs
else {
usingStartOfLineLoop = true
continue startOfLineLoop
}
now, the only thing missing is the } else.
I want to ignore that for now.
let's take line 15: i=14
// findCommentsAndEndLine() is called
replace it with '} function definition to EOL'
now it's identical, except for a newline in the end idk why
there shouldn't be 'newLine startOfLineLoop'
lets just check in the end, if illegal i1