save
@@ -1,66 +0,0 @@ | ||
1 | -/************************************************************************** | |
2 | - * Copyright 2014 Toshiki Iga | |
3 | - * | |
4 | - * Licensed under the Apache License, Version 2.0 (the "License"); | |
5 | - * you may not use this file except in compliance with the License. | |
6 | - * You may obtain a copy of the License at | |
7 | - * http://www.apache.org/licenses/LICENSE-2.0 | |
8 | - * | |
9 | - * Unless required by applicable law or agreed to in writing, software | |
10 | - * distributed under the License is distributed on an "AS IS" BASIS, | |
11 | - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
12 | - * See the License for the specific language governing permissions and | |
13 | - * limitations under the License. | |
14 | - *********************************************************************** */ | |
15 | -/************************************************************************** | |
16 | - * Copyright (c) 2014, Toshiki Iga, All rights reserved. | |
17 | - * | |
18 | - * This library is free software; you can redistribute it and/or | |
19 | - * modify it under the terms of the GNU Lesser General Public | |
20 | - * License as published by the Free Software Foundation; either | |
21 | - * version 3.0 of the License, or (at your option) any later version. | |
22 | - * | |
23 | - * This library is distributed in the hope that it will be useful, | |
24 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
25 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
26 | - * Lesser General Public License for more details. | |
27 | - * | |
28 | - * You should have received a copy of the GNU Lesser General Public | |
29 | - * License along with this library. | |
30 | - * If not, see <http://www.gnu.org/licenses/>. | |
31 | - *********************************************************************** */ | |
32 | -package jp.igapyon.jobjectpascal.parser; | |
33 | - | |
34 | -import java.util.ArrayList; | |
35 | -import java.util.List; | |
36 | - | |
37 | -public abstract class PascalSyntaxToken { | |
38 | - protected String name; | |
39 | - protected String value; | |
40 | - | |
41 | - final protected List<PascalLexicalToken> lexcialTokenList = new ArrayList<PascalLexicalToken>(); | |
42 | - | |
43 | - public void setName(final String val) { | |
44 | - name = val; | |
45 | - } | |
46 | - | |
47 | - public String getName() { | |
48 | - return name; | |
49 | - } | |
50 | - | |
51 | - public void setValue(final String val) { | |
52 | - value = val; | |
53 | - } | |
54 | - | |
55 | - public String getValue() { | |
56 | - return value; | |
57 | - } | |
58 | - | |
59 | - public List<PascalLexicalToken> getLexicalTokenList() { | |
60 | - return lexcialTokenList; | |
61 | - } | |
62 | - | |
63 | - public String getString() { | |
64 | - return getName() + ": " + getValue(); | |
65 | - } | |
66 | -} |
@@ -2,6 +2,8 @@ | ||
2 | 2 | |
3 | 3 | import java.util.List; |
4 | 4 | |
5 | +import jp.igapyon.jobjectpascal.parser.ast.PascalAstNode; | |
6 | + | |
5 | 7 | public class PascalSyntaxProcessInfo { |
6 | 8 | public int lexicalIndex; |
7 | 9 | public List<PascalLexicalToken> lexicalTokenList; |
@@ -16,11 +18,11 @@ | ||
16 | 18 | /** |
17 | 19 | * Output |
18 | 20 | */ |
19 | - public List<PascalSyntaxToken> syntaxTokenList; | |
21 | + public List<PascalAstNode> syntaxTokenList; | |
20 | 22 | |
21 | 23 | public PascalSyntaxProcessInfo(int lexicalIndex, |
22 | 24 | boolean isBreakOnImplementation, |
23 | - List<PascalSyntaxToken> syntaxTokenList) { | |
25 | + List<PascalAstNode> syntaxTokenList) { | |
24 | 26 | this.lexicalIndex = lexicalIndex; |
25 | 27 | this.isBreakOnImplementation = isBreakOnImplementation; |
26 | 28 | this.syntaxTokenList = syntaxTokenList; |
@@ -4,7 +4,7 @@ | ||
4 | 4 | import jp.igapyon.jobjectpascal.parser.PascalLexicalToken; |
5 | 5 | import jp.igapyon.jobjectpascal.parser.PascalSyntaxProcessInfo; |
6 | 6 | import jp.igapyon.jobjectpascal.parser.PascalSyntaxTokenUtil; |
7 | -import jp.igapyon.jobjectpascal.parser.ast.PascalAstNode; | |
7 | +import jp.igapyon.jobjectpascal.parser.ast.PascalAstNodeImpl; | |
8 | 8 | |
9 | 9 | public class PascalSyntaxTokenVarParser { |
10 | 10 | public void parseMuiti(PascalSyntaxProcessInfo processInfo) { |
@@ -34,7 +34,7 @@ | ||
34 | 34 | } |
35 | 35 | |
36 | 36 | public void parse(PascalSyntaxProcessInfo processInfo) { |
37 | - final PascalAstNode statement = new PascalAstNode(); | |
37 | + final PascalAstNodeImpl statement = new PascalAstNodeImpl(); | |
38 | 38 | statement.setName("var"); |
39 | 39 | |
40 | 40 | statement.setValue(PascalSyntaxTokenUtil.readToDelimWithoutWhitespaces( |
@@ -2,11 +2,11 @@ | ||
2 | 2 | |
3 | 3 | import jp.igapyon.jobjectpascal.parser.PascalSyntaxProcessInfo; |
4 | 4 | import jp.igapyon.jobjectpascal.parser.PascalSyntaxTokenUtil; |
5 | -import jp.igapyon.jobjectpascal.parser.ast.PascalAstNode; | |
5 | +import jp.igapyon.jobjectpascal.parser.ast.PascalAstNodeImpl; | |
6 | 6 | |
7 | 7 | public class PascalSyntaxTokenUsesParser { |
8 | 8 | public void parse(PascalSyntaxProcessInfo processInfo) { |
9 | - final PascalAstNode statement = new PascalAstNode(); | |
9 | + final PascalAstNodeImpl statement = new PascalAstNodeImpl(); | |
10 | 10 | statement.setName("uses"); |
11 | 11 | |
12 | 12 | statement.setValue(PascalSyntaxTokenUtil.readToDelimWithoutWhitespaces( |
@@ -4,7 +4,8 @@ | ||
4 | 4 | import jp.igapyon.jobjectpascal.parser.PascalLexicalToken; |
5 | 5 | import jp.igapyon.jobjectpascal.parser.PascalSyntaxProcessInfo; |
6 | 6 | import jp.igapyon.jobjectpascal.parser.PascalSyntaxTokenUtil; |
7 | -import jp.igapyon.jobjectpascal.parser.ast.PascalAstNode; | |
7 | +import jp.igapyon.jobjectpascal.parser.ast.PascalAstConst; | |
8 | +import jp.igapyon.jobjectpascal.parser.ast.PascalAstNodeImpl; | |
8 | 9 | |
9 | 10 | public class PascalSyntaxTokenConstParser { |
10 | 11 | public void parseMuiti(PascalSyntaxProcessInfo processInfo) { |
@@ -34,10 +35,13 @@ | ||
34 | 35 | } |
35 | 36 | |
36 | 37 | public void parse(PascalSyntaxProcessInfo processInfo) { |
37 | - final PascalAstNode statement = new PascalAstNode(); | |
38 | + final PascalAstConst statement = new PascalAstConst(); | |
38 | 39 | statement.setName("const"); |
39 | 40 | |
40 | - statement.setValue(PascalSyntaxTokenUtil.readToDelimWithoutWhitespaces( | |
41 | + statement.setConstName(PascalSyntaxTokenUtil.readToDelimWithoutWhitespaces( | |
42 | + processInfo, "=")); | |
43 | + processInfo.lexicalIndex++; | |
44 | + statement.setConstValue(PascalSyntaxTokenUtil.readToDelimWithoutWhitespaces( | |
41 | 45 | processInfo, ";")); |
42 | 46 | |
43 | 47 | processInfo.syntaxTokenList.add(statement); |
@@ -2,11 +2,11 @@ | ||
2 | 2 | |
3 | 3 | import jp.igapyon.jobjectpascal.parser.PascalSyntaxProcessInfo; |
4 | 4 | import jp.igapyon.jobjectpascal.parser.PascalSyntaxTokenUtil; |
5 | -import jp.igapyon.jobjectpascal.parser.ast.PascalAstNode; | |
5 | +import jp.igapyon.jobjectpascal.parser.ast.PascalAstNodeImpl; | |
6 | 6 | |
7 | 7 | public class PascalSyntaxTokenProgramParser { |
8 | 8 | public void parse(PascalSyntaxProcessInfo processInfo) { |
9 | - final PascalAstNode statement = new PascalAstNode(); | |
9 | + final PascalAstNodeImpl statement = new PascalAstNodeImpl(); | |
10 | 10 | statement.setName("program"); |
11 | 11 | |
12 | 12 | statement.setValue(PascalSyntaxTokenUtil.readToDelimWithoutWhitespaces( |
@@ -1,5 +1,5 @@ | ||
1 | 1 | /************************************************************************** |
2 | - * Copyright 2014-2015 Toshiki Iga | |
2 | + * Copyright 2014 Toshiki Iga | |
3 | 3 | * |
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
5 | 5 | * you may not use this file except in compliance with the License. |
@@ -13,7 +13,7 @@ | ||
13 | 13 | * limitations under the License. |
14 | 14 | *********************************************************************** */ |
15 | 15 | /************************************************************************** |
16 | - * Copyright (c) 2014-2015, Toshiki Iga, All rights reserved. | |
16 | + * Copyright (c) 2014, Toshiki Iga, All rights reserved. | |
17 | 17 | * |
18 | 18 | * This library is free software; you can redistribute it and/or |
19 | 19 | * modify it under the terms of the GNU Lesser General Public |
@@ -34,12 +34,35 @@ | ||
34 | 34 | import java.util.ArrayList; |
35 | 35 | import java.util.List; |
36 | 36 | |
37 | -import jp.igapyon.jobjectpascal.parser.PascalSyntaxToken; | |
37 | +import jp.igapyon.jobjectpascal.parser.PascalLexicalToken; | |
38 | 38 | |
39 | -public class PascalAstNode extends PascalSyntaxToken { | |
40 | - protected List<PascalSyntaxToken> syntaxTokenList = new ArrayList<PascalSyntaxToken>(); | |
39 | +public abstract class PascalAstNode { | |
40 | + protected String name; | |
41 | + protected String value; | |
41 | 42 | |
42 | - public List<PascalSyntaxToken> getSyntaxTokenList(){ | |
43 | - return syntaxTokenList; | |
43 | + final protected List<PascalLexicalToken> lexcialTokenList = new ArrayList<PascalLexicalToken>(); | |
44 | + | |
45 | + public void setName(final String val) { | |
46 | + name = val; | |
44 | 47 | } |
48 | + | |
49 | + public String getName() { | |
50 | + return name; | |
51 | + } | |
52 | + | |
53 | + public void setValue(final String val) { | |
54 | + value = val; | |
55 | + } | |
56 | + | |
57 | + public String getValue() { | |
58 | + return value; | |
59 | + } | |
60 | + | |
61 | + public List<PascalLexicalToken> getLexicalTokenList() { | |
62 | + return lexcialTokenList; | |
63 | + } | |
64 | + | |
65 | + public String getString() { | |
66 | + return getName() + ": " + getValue(); | |
67 | + } | |
45 | 68 | } |
@@ -0,0 +1,26 @@ | ||
1 | +package jp.igapyon.jobjectpascal.parser.ast; | |
2 | + | |
3 | +public class PascalAstConst extends PascalAstNodeImpl { | |
4 | + protected String constName; | |
5 | + protected String constValue; | |
6 | + | |
7 | + public String getConstName() { | |
8 | + return constName; | |
9 | + } | |
10 | + | |
11 | + public void setConstName(String constName) { | |
12 | + this.constName = constName; | |
13 | + } | |
14 | + | |
15 | + public String getConstValue() { | |
16 | + return constValue; | |
17 | + } | |
18 | + | |
19 | + public void setConstValue(String constValue) { | |
20 | + this.constValue = constValue; | |
21 | + } | |
22 | + | |
23 | + public String getString() { | |
24 | + return getName() + ": " + getConstName() + ": " + getConstValue(); | |
25 | + } | |
26 | +} |
@@ -0,0 +1,43 @@ | ||
1 | +/************************************************************************** | |
2 | + * Copyright 2014-2015 Toshiki Iga | |
3 | + * | |
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | |
5 | + * you may not use this file except in compliance with the License. | |
6 | + * You may obtain a copy of the License at | |
7 | + * http://www.apache.org/licenses/LICENSE-2.0 | |
8 | + * | |
9 | + * Unless required by applicable law or agreed to in writing, software | |
10 | + * distributed under the License is distributed on an "AS IS" BASIS, | |
11 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
12 | + * See the License for the specific language governing permissions and | |
13 | + * limitations under the License. | |
14 | + *********************************************************************** */ | |
15 | +/************************************************************************** | |
16 | + * Copyright (c) 2014-2015, Toshiki Iga, All rights reserved. | |
17 | + * | |
18 | + * This library is free software; you can redistribute it and/or | |
19 | + * modify it under the terms of the GNU Lesser General Public | |
20 | + * License as published by the Free Software Foundation; either | |
21 | + * version 3.0 of the License, or (at your option) any later version. | |
22 | + * | |
23 | + * This library is distributed in the hope that it will be useful, | |
24 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
25 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
26 | + * Lesser General Public License for more details. | |
27 | + * | |
28 | + * You should have received a copy of the GNU Lesser General Public | |
29 | + * License along with this library. | |
30 | + * If not, see <http://www.gnu.org/licenses/>. | |
31 | + *********************************************************************** */ | |
32 | +package jp.igapyon.jobjectpascal.parser.ast; | |
33 | + | |
34 | +import java.util.ArrayList; | |
35 | +import java.util.List; | |
36 | + | |
37 | +public class PascalAstNodeImpl extends PascalAstNode { | |
38 | + protected List<PascalAstNode> syntaxTokenList = new ArrayList<PascalAstNode>(); | |
39 | + | |
40 | + public List<PascalAstNode> getSyntaxTokenList(){ | |
41 | + return syntaxTokenList; | |
42 | + } | |
43 | +} |
@@ -1,7 +1,7 @@ | ||
1 | 1 | package jp.igapyon.jobjectpascal.parser.ast; |
2 | 2 | |
3 | 3 | |
4 | -public class PascalAstType extends PascalAstNode { | |
4 | +public class PascalAstType extends PascalAstNodeImpl { | |
5 | 5 | protected String typeName; |
6 | 6 | protected String parentTypeName; |
7 | 7 | protected boolean forwardDeclaration = false; |
@@ -42,6 +42,7 @@ | ||
42 | 42 | import jp.igapyon.jobjectpascal.PascalConstants; |
43 | 43 | import jp.igapyon.jobjectpascal.PascalConstants.TokenType; |
44 | 44 | import jp.igapyon.jobjectpascal.parser.ast.PascalAstNode; |
45 | +import jp.igapyon.jobjectpascal.parser.ast.PascalAstNodeImpl; | |
45 | 46 | import jp.igapyon.jobjectpascal.parser.ast.PascalAstType; |
46 | 47 | import jp.igapyon.jobjectpascal.parser.syntax.PascalSyntaxTokenConstParser; |
47 | 48 | import jp.igapyon.jobjectpascal.parser.syntax.PascalSyntaxTokenProgramParser; |
@@ -52,7 +53,7 @@ | ||
52 | 53 | protected static final boolean IS_DEBUG = false; |
53 | 54 | |
54 | 55 | protected PascalSyntaxProcessInfo processInfo = new PascalSyntaxProcessInfo(0, true, |
55 | - new ArrayList<PascalSyntaxToken>()); | |
56 | + new ArrayList<PascalAstNode>()); | |
56 | 57 | |
57 | 58 | protected void setBreakOnImplementation(final boolean breakOnImplementation) { |
58 | 59 | processInfo.isBreakOnImplementation = breakOnImplementation; |
@@ -71,21 +72,21 @@ | ||
71 | 72 | public static void main(String[] args) throws IOException { |
72 | 73 | final PascalSyntaxTokenParser parser = new PascalSyntaxTokenParser(); |
73 | 74 | parser.setBreakOnImplementation(true); |
74 | - final List<PascalSyntaxToken> syntaxTokenList = parser.parse(new File( | |
75 | + final List<PascalAstNode> syntaxTokenList = parser.parse(new File( | |
75 | 76 | "./test/data/op/TestSrc005.pas")); |
76 | 77 | System.out.println("Result:"); |
77 | - for (PascalSyntaxToken syntax : syntaxTokenList) { | |
78 | + for (PascalAstNode syntax : syntaxTokenList) { | |
78 | 79 | System.out.println(syntax.getString()); |
79 | 80 | } |
80 | 81 | } |
81 | 82 | |
82 | - public List<PascalSyntaxToken> parse(final File file) throws IOException { | |
83 | + public List<PascalAstNode> parse(final File file) throws IOException { | |
83 | 84 | // TODO encoding is UTF8? really? |
84 | 85 | return parse(new BufferedReader(new InputStreamReader( |
85 | 86 | new FileInputStream(file), "UTF8"))); |
86 | 87 | } |
87 | 88 | |
88 | - public List<PascalSyntaxToken> parse(final BufferedReader reader) | |
89 | + public List<PascalAstNode> parse(final BufferedReader reader) | |
89 | 90 | throws IOException { |
90 | 91 | processInfo.lexicalTokenList = new PascalLexicalTokenParser().parse(reader); |
91 | 92 | processInfo.lexicalIndex = 0; |
@@ -98,7 +99,7 @@ | ||
98 | 99 | * |
99 | 100 | * @throws IOException |
100 | 101 | */ |
101 | - protected void parseTopLoop(final PascalAstNode parentStatement) | |
102 | + protected void parseTopLoop(final PascalAstNodeImpl parentStatement) | |
102 | 103 | throws IOException { |
103 | 104 | boolean isInInterface=false; |
104 | 105 | boolean isInImplementation=false; |
@@ -114,7 +115,7 @@ | ||
114 | 115 | processInfo.lexicalIndex++; |
115 | 116 | new PascalSyntaxTokenProgramParser().parse(processInfo); |
116 | 117 | } else if ("unit".equals(wordSymbol)) { |
117 | - final PascalAstNode statement = parseUnit(); | |
118 | + final PascalAstNodeImpl statement = parseUnit(); | |
118 | 119 | processInfo.syntaxTokenList.add(statement); |
119 | 120 | } else if ("uses".equals(wordSymbol)) { |
120 | 121 | processInfo.lexicalIndex++; |
@@ -146,7 +147,7 @@ | ||
146 | 147 | //parseProcedureDecl(); |
147 | 148 | } else if ("begin".equals(token.getWord().toLowerCase())) { |
148 | 149 | // for command line style. |
149 | - final PascalAstNode statement = parseBegin(); | |
150 | + final PascalAstNodeImpl statement = parseBegin(); | |
150 | 151 | processInfo.syntaxTokenList.add(statement); |
151 | 152 | // } else if ("end".equals(token.getWord().toLowerCase())) { |
152 | 153 | // FIXME will be needed again. |
@@ -178,7 +179,7 @@ | ||
178 | 179 | * @param parentStatement |
179 | 180 | * @throws IOException |
180 | 181 | */ |
181 | - protected void parseTopLoopDummy(final PascalAstNode parentStatement) | |
182 | + protected void parseTopLoopDummy(final PascalAstNodeImpl parentStatement) | |
182 | 183 | throws IOException { |
183 | 184 | for (; processInfo.lexicalIndex < processInfo.lexicalTokenList.size(); processInfo.lexicalIndex++) { |
184 | 185 | final PascalLexicalToken token = processInfo.lexicalTokenList.get(processInfo.lexicalIndex); |
@@ -189,18 +190,18 @@ | ||
189 | 190 | if (token.getType() == PascalConstants.TokenType.WORD_SYMBOL) { |
190 | 191 | final String wordSymbol = token.getWord().toLowerCase(); |
191 | 192 | if ("unit".equals(wordSymbol)) { |
192 | - final PascalAstNode statement = parseUnit(); | |
193 | + final PascalAstNodeImpl statement = parseUnit(); | |
193 | 194 | processInfo.syntaxTokenList.add(statement); |
194 | 195 | } else if ("uses".equals(wordSymbol)) { |
195 | - final PascalAstNode statement = parseUses(); | |
196 | + final PascalAstNodeImpl statement = parseUses(); | |
196 | 197 | processInfo.syntaxTokenList.add(statement); |
197 | 198 | } else if ("type".equals(wordSymbol)) { |
198 | 199 | parseTypeDummy(); |
199 | 200 | } else if ("begin".equals(token.getWord().toLowerCase())) { |
200 | - final PascalAstNode statement = parseBegin(); | |
201 | + final PascalAstNodeImpl statement = parseBegin(); | |
201 | 202 | processInfo.syntaxTokenList.add(statement); |
202 | 203 | } else if ("try".equals(token.getWord().toLowerCase())) { |
203 | - final PascalAstNode statement = parseTry(); | |
204 | + final PascalAstNodeImpl statement = parseTry(); | |
204 | 205 | processInfo.syntaxTokenList.add(statement); |
205 | 206 | } else if ("raise".equals(token.getWord().toLowerCase())) { |
206 | 207 | // TODO impl. |
@@ -228,7 +229,7 @@ | ||
228 | 229 | } |
229 | 230 | } |
230 | 231 | |
231 | - public void parseToSemicolon(final PascalAstNode statement) { | |
232 | + public void parseToSemicolon(final PascalAstNodeImpl statement) { | |
232 | 233 | String value = ""; |
233 | 234 | for (; processInfo.lexicalIndex < processInfo.lexicalTokenList.size(); processInfo.lexicalIndex++) { |
234 | 235 | final PascalLexicalToken token = processInfo.lexicalTokenList.get(processInfo.lexicalIndex); |
@@ -248,8 +249,8 @@ | ||
248 | 249 | statement.setValue(value); |
249 | 250 | } |
250 | 251 | |
251 | - protected PascalAstNode parseUnit() { | |
252 | - final PascalAstNode statement = new PascalAstNode(); | |
252 | + protected PascalAstNodeImpl parseUnit() { | |
253 | + final PascalAstNodeImpl statement = new PascalAstNodeImpl(); | |
253 | 254 | statement.setName(processInfo.lexicalTokenList.get(processInfo.lexicalIndex++).getWord() |
254 | 255 | .toLowerCase()); |
255 | 256 |
@@ -258,8 +259,8 @@ | ||
258 | 259 | return statement; |
259 | 260 | } |
260 | 261 | |
261 | - protected PascalAstNode parseUses() { | |
262 | - final PascalAstNode statement = new PascalAstNode(); | |
262 | + protected PascalAstNodeImpl parseUses() { | |
263 | + final PascalAstNodeImpl statement = new PascalAstNodeImpl(); | |
263 | 264 | statement.setName(processInfo.lexicalTokenList.get(processInfo.lexicalIndex++).getWord() |
264 | 265 | .toLowerCase()); |
265 | 266 |
@@ -558,8 +559,8 @@ | ||
558 | 559 | } |
559 | 560 | } |
560 | 561 | |
561 | - protected PascalAstNode parseBegin() throws IOException { | |
562 | - final PascalAstNode statement = new PascalAstNode(); | |
562 | + protected PascalAstNodeImpl parseBegin() throws IOException { | |
563 | + final PascalAstNodeImpl statement = new PascalAstNodeImpl(); | |
563 | 564 | statement.setName(processInfo.lexicalTokenList.get(processInfo.lexicalIndex++).getWord() |
564 | 565 | .toLowerCase()); |
565 | 566 |
@@ -568,8 +569,8 @@ | ||
568 | 569 | return statement; |
569 | 570 | } |
570 | 571 | |
571 | - protected PascalAstNode parseTry() throws IOException { | |
572 | - final PascalAstNode statement = new PascalAstNode(); | |
572 | + protected PascalAstNodeImpl parseTry() throws IOException { | |
573 | + final PascalAstNodeImpl statement = new PascalAstNodeImpl(); | |
573 | 574 | statement.setName(processInfo.lexicalTokenList.get(processInfo.lexicalIndex++).getWord() |
574 | 575 | .toLowerCase()); |
575 | 576 |
@@ -37,6 +37,7 @@ | ||
37 | 37 | import java.util.List; |
38 | 38 | |
39 | 39 | import jp.igapyon.jobjectpascal.PascalConstants; |
40 | +import jp.igapyon.jobjectpascal.parser.ast.PascalAstNode; | |
40 | 41 | import jp.igapyon.jobjectpascal.parser.ast.PascalAstType; |
41 | 42 | |
42 | 43 | public class PascalSyntaxTokenUtil { |
@@ -86,9 +87,9 @@ | ||
86 | 87 | try { |
87 | 88 | final PascalSyntaxTokenParser parser = new PascalSyntaxTokenParser(); |
88 | 89 | parser.setBreakOnImplementation(true); |
89 | - final List<PascalSyntaxToken> syntaxTokenList = parser.parse(file); | |
90 | + final List<PascalAstNode> syntaxTokenList = parser.parse(file); | |
90 | 91 | |
91 | - for (PascalSyntaxToken syntax : syntaxTokenList) { | |
92 | + for (PascalAstNode syntax : syntaxTokenList) { | |
92 | 93 | if (syntax.getName().toLowerCase().equals("unit")) { |
93 | 94 | return syntax.getValue(); |
94 | 95 | } |
@@ -104,9 +105,9 @@ | ||
104 | 105 | try { |
105 | 106 | final PascalSyntaxTokenParser parser = new PascalSyntaxTokenParser(); |
106 | 107 | parser.setBreakOnImplementation(true); |
107 | - final List<PascalSyntaxToken> syntaxTokenList = parser.parse(file); | |
108 | + final List<PascalAstNode> syntaxTokenList = parser.parse(file); | |
108 | 109 | |
109 | - for (PascalSyntaxToken syntax : syntaxTokenList) { | |
110 | + for (PascalAstNode syntax : syntaxTokenList) { | |
110 | 111 | if (syntax.getName().toLowerCase().equals("type")) { |
111 | 112 | PascalAstType statementType = (PascalAstType) syntax; |
112 | 113 | if (statementType.isForwardDeclaration()) { |