author | Claus Gittinger <cg@exept.de> |
Fri, 21 Feb 2020 20:48:14 +0100 | |
changeset 1231 | b7d945ef967a |
parent 1220 | bc9a4740d530 |
permissions | -rw-r--r-- |
1076 | 1 |
"{ Encoding: utf8 }" |
2 |
||
1220 | 3 |
" |
4 |
COPYRIGHT (c) 2018 by eXept Software AG |
|
5 |
All Rights Reserved |
|
6 |
||
7 |
This software is furnished under a license and may be used |
|
8 |
only in accordance with the terms of that license and with the |
|
9 |
inclusion of the above copyright notice. This software may not |
|
10 |
be provided or otherwise made available to, or used by, any |
|
11 |
other person. No title to or ownership of the software is |
|
12 |
hereby transferred. |
|
13 |
" |
|
692 | 14 |
"{ Package: 'stx:libjavascript' }" |
15 |
||
1076 | 16 |
"{ NameSpace: Smalltalk }" |
17 |
||
692 | 18 |
JavaScriptParser subclass:#JavaScriptCompletionParser |
836 | 19 |
instanceVariableNames:'nodeRewriteHook error' |
692 | 20 |
classVariableNames:'' |
21 |
poolDictionaries:'' |
|
22 |
category:'Languages-JavaScript-Compiling & Parsing' |
|
23 |
! |
|
24 |
||
1220 | 25 |
!JavaScriptCompletionParser class methodsFor:'documentation'! |
26 |
||
27 |
copyright |
|
28 |
" |
|
29 |
COPYRIGHT (c) 2018 by eXept Software AG |
|
30 |
All Rights Reserved |
|
31 |
||
32 |
This software is furnished under a license and may be used |
|
33 |
only in accordance with the terms of that license and with the |
|
34 |
inclusion of the above copyright notice. This software may not |
|
35 |
be provided or otherwise made available to, or used by, any |
|
36 |
other person. No title to or ownership of the software is |
|
37 |
hereby transferred. |
|
38 |
" |
|
39 |
! ! |
|
692 | 40 |
|
41 |
!JavaScriptCompletionParser methodsFor:'accessing'! |
|
42 |
||
43 |
nodeRewriteHook |
|
44 |
^ nodeRewriteHook |
|
45 |
! |
|
46 |
||
47 |
nodeRewriteHook:oneArgBlock |
|
48 |
nodeRewriteHook := oneArgBlock. |
|
49 |
! ! |
|
50 |
||
701
740af7ecc058
Support for completing variables.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
692
diff
changeset
|
51 |
!JavaScriptCompletionParser methodsFor:'error handling'! |
740af7ecc058
Support for completing variables.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
692
diff
changeset
|
52 |
|
836 | 53 |
parseError:message position:startPos to:endPos |
701
740af7ecc058
Support for completing variables.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
692
diff
changeset
|
54 |
|
836 | 55 |
error := ParseErrorNode new |
56 |
errorString: message; |
|
57 |
errorToken: (token notNil ifTrue:[token asString] ifFalse:[nil]); |
|
58 |
startPosition: startPos endPosition: endPos. |
|
59 |
^ super parseError:message position:startPos to:endPos |
|
60 |
||
61 |
"Created: / 27-11-2011 / 09:35:19 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
62 |
"Modified: / 26-09-2014 / 20:22:35 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
701
740af7ecc058
Support for completing variables.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
692
diff
changeset
|
63 |
! ! |
740af7ecc058
Support for completing variables.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
692
diff
changeset
|
64 |
|
692 | 65 |
!JavaScriptCompletionParser methodsFor:'initialization'! |
66 |
||
67 |
initialize |
|
68 |
"Invoked when a new instance is created." |
|
69 |
||
70 |
"/ please change as required (and remove this comment) |
|
71 |
||
72 |
super initialize. |
|
73 |
nodeRewriteHook := [:node | node ]. |
|
74 |
||
75 |
"Modified: / 23-09-2013 / 13:33:45 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
76 |
! ! |
|
77 |
||
78 |
!JavaScriptCompletionParser methodsFor:'parsing-expressions'! |
|
79 |
||
80 |
expression |
|
725
1654323dc2fd
class: JavaScriptCompletionParser
Claus Gittinger <cg@exept.de>
parents:
708
diff
changeset
|
81 |
|expr| |
1654323dc2fd
class: JavaScriptCompletionParser
Claus Gittinger <cg@exept.de>
parents:
708
diff
changeset
|
82 |
|
728
34a44a79fc2e
class: JavaScriptCompletionParser
Stefan Vogel <sv@exept.de>
parents:
725
diff
changeset
|
83 |
(expr := super expression) isNil ifTrue:[^ nil]. |
725
1654323dc2fd
class: JavaScriptCompletionParser
Claus Gittinger <cg@exept.de>
parents:
708
diff
changeset
|
84 |
^ nodeRewriteHook value: expr. |
692 | 85 |
|
86 |
"Created: / 16-06-2011 / 14:58:11 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
87 |
"Modified: / 23-09-2013 / 13:32:36 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
725
1654323dc2fd
class: JavaScriptCompletionParser
Claus Gittinger <cg@exept.de>
parents:
708
diff
changeset
|
88 |
"Modified: / 06-11-2013 / 17:26:40 / cg" |
692 | 89 |
! |
90 |
||
1076 | 91 |
functionCallExpression:recIn |
92 |
|node| |
|
93 |
||
94 |
node := super functionCallExpression:recIn. |
|
95 |
^ nodeRewriteHook value:node. |
|
96 |
||
97 |
"Created: / 21-03-2019 / 10:03:45 / Claus Gittinger" |
|
98 |
! |
|
99 |
||
708
e579a063d162
Minor fixes, making StatementBlockNode obsolete.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
701
diff
changeset
|
100 |
newExpression |
e579a063d162
Minor fixes, making StatementBlockNode obsolete.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
701
diff
changeset
|
101 |
| node | |
e579a063d162
Minor fixes, making StatementBlockNode obsolete.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
701
diff
changeset
|
102 |
|
e579a063d162
Minor fixes, making StatementBlockNode obsolete.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
701
diff
changeset
|
103 |
node := super newExpression. |
e579a063d162
Minor fixes, making StatementBlockNode obsolete.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
701
diff
changeset
|
104 |
node classOrFunc: (nodeRewriteHook value: node classOrFunc). |
e579a063d162
Minor fixes, making StatementBlockNode obsolete.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
701
diff
changeset
|
105 |
^ node |
e579a063d162
Minor fixes, making StatementBlockNode obsolete.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
701
diff
changeset
|
106 |
|
e579a063d162
Minor fixes, making StatementBlockNode obsolete.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
701
diff
changeset
|
107 |
"Created: / 24-09-2013 / 17:58:58 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
e579a063d162
Minor fixes, making StatementBlockNode obsolete.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
701
diff
changeset
|
108 |
! |
e579a063d162
Minor fixes, making StatementBlockNode obsolete.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
701
diff
changeset
|
109 |
|
692 | 110 |
primaryExpression |
725
1654323dc2fd
class: JavaScriptCompletionParser
Claus Gittinger <cg@exept.de>
parents:
708
diff
changeset
|
111 |
|expr| |
1654323dc2fd
class: JavaScriptCompletionParser
Claus Gittinger <cg@exept.de>
parents:
708
diff
changeset
|
112 |
|
728
34a44a79fc2e
class: JavaScriptCompletionParser
Stefan Vogel <sv@exept.de>
parents:
725
diff
changeset
|
113 |
(expr := super primaryExpression) isNil ifTrue:[^ nil]. |
725
1654323dc2fd
class: JavaScriptCompletionParser
Claus Gittinger <cg@exept.de>
parents:
708
diff
changeset
|
114 |
^ nodeRewriteHook value: expr. |
692 | 115 |
|
116 |
"Created: / 22-07-2013 / 15:37:04 / cg" |
|
117 |
"Modified: / 23-09-2013 / 13:34:19 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
725
1654323dc2fd
class: JavaScriptCompletionParser
Claus Gittinger <cg@exept.de>
parents:
708
diff
changeset
|
118 |
"Modified: / 06-11-2013 / 17:26:07 / cg" |
692 | 119 |
! |
120 |
||
121 |
unaryExpression |
|
725
1654323dc2fd
class: JavaScriptCompletionParser
Claus Gittinger <cg@exept.de>
parents:
708
diff
changeset
|
122 |
|expr| |
1654323dc2fd
class: JavaScriptCompletionParser
Claus Gittinger <cg@exept.de>
parents:
708
diff
changeset
|
123 |
|
728
34a44a79fc2e
class: JavaScriptCompletionParser
Stefan Vogel <sv@exept.de>
parents:
725
diff
changeset
|
124 |
(expr := super unaryExpression) isNil ifTrue:[^ nil]. |
725
1654323dc2fd
class: JavaScriptCompletionParser
Claus Gittinger <cg@exept.de>
parents:
708
diff
changeset
|
125 |
^ nodeRewriteHook value: expr. |
692 | 126 |
|
127 |
"Created: / 05-07-2011 / 23:08:54 / cg" |
|
128 |
"Modified: / 23-09-2013 / 13:34:31 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
725
1654323dc2fd
class: JavaScriptCompletionParser
Claus Gittinger <cg@exept.de>
parents:
708
diff
changeset
|
129 |
"Modified: / 06-11-2013 / 17:26:22 / cg" |
692 | 130 |
! ! |
131 |
||
132 |
!JavaScriptCompletionParser class methodsFor:'documentation'! |
|
133 |
||
134 |
version |
|
135 |
^ '$Header$' |
|
136 |
! |
|
137 |
||
138 |
version_CVS |
|
139 |
^ '$Header$' |
|
140 |
! ! |
|
141 |