root/org.axdt.as3/src/org/axdt/as3/analysis/AS3TokenHelper.java @ 5c182b6e475d5851c54cdb2117f25af21723b62a

Revision 5c182b6e475d5851c54cdb2117f25af21723b62a, 1.1 KB (checked in by mb0 <mb0@…>, 15 months ago)

memory clean up ! (and several minor fixes)

  • merged symboltablevisitor and indexingvisitor together with some basic syntax checks to form as3analysis
  • index0r can now be used to request details on demand.
  • axdoc parser ignores whitespace textnodes and now parses the member code span
  • axdoc model: moved level property to indexnode and changed it to be persisted
  • changed axlevel literals
  • discover memory leak  http://bugs.eclipse.org/281790, cleaned up with editor service.
  • moved usefull generally useful methods out of as3 content proposer into as3 source helper
  • when no index exists for a source folder the project will be built and cached.
  • builder does not cache anymore instead builds two times. the first time to index. the second time to resolve.
  • lexer helper error detection fixed ater working through the sparce documentation on lpgs deterministic parser.
  • moved top level symbol table to the program ast node
  • some minor parser changed
  • Property mode set to 100644
Line 
1package org.axdt.as3.analysis;
2
3import java.util.ArrayList;
4
5import lpg.runtime.IToken;
6
7import org.axdt.as3.imp.parser.AS3Parsersym;
8
9public class AS3TokenHelper implements AS3Parsersym {
10        private static String[] keywords = null;
11       
12        public static String[] getKeyWords() {
13                if (keywords == null)
14                        keywords = createKeywords();
15                return keywords;
16        }
17       
18        public static boolean isKeyword(IToken t) {
19                int kind = t.getKind();
20                if (kind > 1 && kind < orderedTerminalSymbols.length) {
21                        return orderedTerminalSymbols[kind].charAt(0) > 'Z';
22                }
23                return false;
24        }
25
26        public static String getPrefix(int o, IToken t) {
27                return t.getKind() == TK_IDENTIFIER ?
28                                t.toString().substring(0, o-t.getStartOffset()) : "";
29        }
30
31        public static boolean isWithinToken(int o, IToken t) {
32                return o >= t.getStartOffset() && o <= t.getEndOffset();
33        }
34       
35        private static String[] createKeywords() {
36                ArrayList<String> result = new ArrayList<String>();
37                for (int i = 1; i < orderedTerminalSymbols.length; i++) {
38                        if (orderedTerminalSymbols[i].charAt(0) > 'Z')
39                                result.add(orderedTerminalSymbols[i]);
40                }
41                return result.toArray(new String[result.size()]);
42        }
43}
Note: See TracBrowser for help on using the browser.