• R/O
  • SSH
  • HTTPS

jobjectpascal: Commit


Commit MetaInfo

Revision135 (tree)
Time2015-06-14 07:50:14
Authoriga

Log Message

save

Change Summary

Incremental Difference

--- trunk/src/jp/igapyon/jobjectpascal/parser/syntax/PascalSyntaxTokenTypeParser.java (revision 134)
+++ trunk/src/jp/igapyon/jobjectpascal/parser/syntax/PascalSyntaxTokenTypeParser.java (revision 135)
@@ -66,21 +66,64 @@
6666 if (PascalConstants.TokenType.WORD_SYMBOL == nextToken.getType()) {
6767 if ("class".equals(nextToken.getWord().toLowerCase())) {
6868 ast.setTypeType(nextToken.getWord());
69- }else{
69+ } else {
7070 System.out.println("type: NOT IMPLEMENTED");
7171 }
7272 }
7373 }
7474
75+ // FIXME below is for class only!
76+
77+ // check decl only or not
7578 {
7679 final PascalLexicalToken checkToken = PascalSyntaxTokenUtil
7780 .checkNextTokenWithoutWhitespaces(processInfo);
7881 if (PascalConstants.TokenType.SPECIAL_SYMBOL_WITHOUT_WORD == checkToken
79- .getType()){
80- ast.setForwardDeclaration(true);
81- // only for decl. return here.
82- return;
82+ .getType()) {
83+ if (";".equals(checkToken.getWord())) {
84+ ast.setForwardDeclaration(true);
85+ // only for decl. return here.
86+ return;
87+ }
8388 }
8489 }
90+
91+ // check parent() or not
92+ {
93+ final PascalLexicalToken checkToken = PascalSyntaxTokenUtil
94+ .checkNextTokenWithoutWhitespaces(processInfo);
95+ if (PascalConstants.TokenType.SPECIAL_SYMBOL_WITHOUT_WORD == checkToken
96+ .getType()) {
97+ if ("(".equals(checkToken.getWord())) {
98+ // parent exist
99+ processInfo.lexicalIndex = checkToken.getLexicalIndex() + 1;
100+ final String nextString = PascalSyntaxTokenUtil
101+ .readToDelimWithoutWhitespaces(processInfo, ")");
102+ ast.setParentTypeName(nextString);
103+ processInfo.lexicalIndex++;
104+ }
105+ }
106+ }
107+
108+ for (;;) {
109+ final PascalLexicalToken nextToken = PascalSyntaxTokenUtil
110+ .readNextTokenWithoutWhitespaces(processInfo);
111+ if (PascalConstants.TokenType.WORD_SYMBOL == nextToken.getType()) {
112+ final String wordSymbol = nextToken.getWord().toLowerCase();
113+ if ("end".equals(wordSymbol)) {
114+ // end of type
115+ return;
116+ } else {
117+ System.out.println("type: NOT IMPLEMENTED: " + wordSymbol);
118+ }
119+ } else {
120+ // simple line
121+ final String nextString = PascalSyntaxTokenUtil
122+ .readToDelimWithoutWhitespaces(processInfo, ";");
123+ processInfo.lexicalIndex++;
124+
125+ System.out.println(nextToken.getWord() + nextString);
126+ }
127+ }
85128 }
86129 }
Show on old repository browser