├── images ├── ts.png ├── ts24.png ├── ts_400x400.png ├── typescript-coloring.png ├── typescript-filetype.png ├── typescript-options.png ├── typescript-properties.png └── typescript-sample-greeter.png ├── .gitignore ├── src └── main │ ├── resources │ └── org │ │ └── netbeans │ │ └── ts │ │ ├── filetype │ │ ├── ts.png │ │ └── TsTemplate.ts │ │ ├── Bundle.properties │ │ ├── samples │ │ └── projects │ │ │ └── greeter │ │ │ ├── Greeter.png │ │ │ ├── GreeterProject.zip │ │ │ ├── Bundle.properties │ │ │ └── GreeterDescription.html │ │ ├── TsPreview.ts │ │ ├── options │ │ └── Bundle.properties │ │ ├── FontAndColors.xml │ │ ├── layer.xml │ │ └── codetemplates.xml │ ├── nbm │ └── manifest.mf │ └── java │ └── org │ └── netbeans │ └── ts │ ├── filetype │ ├── package-info.java │ └── TsDataObject.java │ ├── lexer │ ├── ECMAScriptLanguage.java │ ├── ECMAScriptTokenId.java │ ├── ECMAScriptNBLexer.java │ ├── ECMAScriptLanguageHierarchy.java │ ├── ECMAScriptLexer.tokens │ ├── TokenType.java │ ├── AntlrCharStream.java │ └── ECMAScriptLexer.java │ ├── syntaxhighlighter │ └── TsLanguageProvider.java │ ├── completion │ └── TsCompletionProvider.java │ ├── TypeScriptCustomizer.java │ ├── samples │ └── projects │ │ └── greeter │ │ ├── GreeterWizardPanel.java │ │ ├── GreeterPanelVisual.form │ │ ├── GreeterWizardIterator.java │ │ └── GreeterPanelVisual.java │ ├── options │ ├── TypeScriptOptionsPanelController.java │ ├── StringUtils.java │ ├── FileUtils.java │ ├── TypeScriptOptionsPanel.form │ └── TypeScriptOptionsPanel.java │ └── JSOnSaveHook.java ├── README.md ├── pom.xml └── ECMAScript.g4 /images/ts.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GeertjanWielenga/TypeScript/HEAD/images/ts.png -------------------------------------------------------------------------------- /images/ts24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GeertjanWielenga/TypeScript/HEAD/images/ts24.png -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /target/ 2 | /antlr/Antlr/nbproject/private/ 3 | /antlr/Antlr/dist/ 4 | /antlr/Antlr/build/ -------------------------------------------------------------------------------- /images/ts_400x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GeertjanWielenga/TypeScript/HEAD/images/ts_400x400.png -------------------------------------------------------------------------------- /images/typescript-coloring.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GeertjanWielenga/TypeScript/HEAD/images/typescript-coloring.png -------------------------------------------------------------------------------- /images/typescript-filetype.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GeertjanWielenga/TypeScript/HEAD/images/typescript-filetype.png -------------------------------------------------------------------------------- /images/typescript-options.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GeertjanWielenga/TypeScript/HEAD/images/typescript-options.png -------------------------------------------------------------------------------- /images/typescript-properties.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GeertjanWielenga/TypeScript/HEAD/images/typescript-properties.png -------------------------------------------------------------------------------- /images/typescript-sample-greeter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GeertjanWielenga/TypeScript/HEAD/images/typescript-sample-greeter.png -------------------------------------------------------------------------------- /src/main/resources/org/netbeans/ts/filetype/ts.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GeertjanWielenga/TypeScript/HEAD/src/main/resources/org/netbeans/ts/filetype/ts.png -------------------------------------------------------------------------------- /src/main/nbm/manifest.mf: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | OpenIDE-Module-Layer: org/netbeans/ts/layer.xml 3 | OpenIDE-Module-Localizing-Bundle: org/netbeans/ts/Bundle.properties 4 | 5 | -------------------------------------------------------------------------------- /src/main/resources/org/netbeans/ts/Bundle.properties: -------------------------------------------------------------------------------- 1 | text/x-ts=TypeScript 2 | constructor=Constructor 3 | var=Var 4 | character=Character 5 | keyword=Keyword 6 | comment=Comment 7 | whitespace=Whitespace 8 | -------------------------------------------------------------------------------- /src/main/resources/org/netbeans/ts/samples/projects/greeter/Greeter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GeertjanWielenga/TypeScript/HEAD/src/main/resources/org/netbeans/ts/samples/projects/greeter/Greeter.png -------------------------------------------------------------------------------- /src/main/resources/org/netbeans/ts/samples/projects/greeter/GreeterProject.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GeertjanWielenga/TypeScript/HEAD/src/main/resources/org/netbeans/ts/samples/projects/greeter/GreeterProject.zip -------------------------------------------------------------------------------- /src/main/java/org/netbeans/ts/filetype/package-info.java: -------------------------------------------------------------------------------- 1 | @TemplateRegistration( 2 | requireProject = false, 3 | folder = "TypeScript", 4 | content = "TsTemplate.ts") 5 | package org.netbeans.ts.filetype; 6 | 7 | import org.netbeans.api.templates.TemplateRegistration; 8 | -------------------------------------------------------------------------------- /src/main/resources/org/netbeans/ts/TsPreview.ts: -------------------------------------------------------------------------------- 1 | class Greeter { 2 | constructor(public greeting: string) { } 3 | greet() { 4 | return "

" + this.greeting + "

"; 5 | } 6 | }; 7 | 8 | var greeter = new Greeter("Hello, world!"); 9 | 10 | document.body.innerHTML = greeter.greet(); 11 | -------------------------------------------------------------------------------- /src/main/resources/org/netbeans/ts/filetype/TsTemplate.ts: -------------------------------------------------------------------------------- 1 | class Greeter { 2 | constructor(public greeting: string) { } 3 | greet() { 4 | return "

" + this.greeting + "

"; 5 | } 6 | }; 7 | 8 | var greeter = new Greeter("Hello, world!"); 9 | 10 | document.body.innerHTML = greeter.greet(); 11 | -------------------------------------------------------------------------------- /src/main/resources/org/netbeans/ts/samples/projects/greeter/Bundle.properties: -------------------------------------------------------------------------------- 1 | LBL_CreateProjectStep=Name and Location 2 | GreeterPanelVisual.createdFolderLabel.text=Project &Folder: 3 | GreeterPanelVisual.browseButton.actionCommand=BROWSE 4 | GreeterPanelVisual.browseButton.text=Br&owse... 5 | GreeterPanelVisual.projectLocationLabel.text=Project &Location: 6 | GreeterPanelVisual.projectNameLabel.text=Project &Name: 7 | -------------------------------------------------------------------------------- /src/main/resources/org/netbeans/ts/samples/projects/greeter/GreeterDescription.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 |

Sample Greeter project from https://github.com/Microsoft/TypeScriptSamples:

7 |

https://github.com/Microsoft/TypeScriptSamples/tree/master/greeter

8 | 9 | 10 | -------------------------------------------------------------------------------- /src/main/resources/org/netbeans/ts/options/Bundle.properties: -------------------------------------------------------------------------------- 1 | # keywords - XXX how to get tab title properly? 2 | TypeScriptOptionsPanel.installTypeScriptLabel.text=Install TypeScript 3 | TypeScriptOptionsPanel.TypeScriptPathLabel.text=&TypeScript Path: 4 | TypeScriptOptionsPanel.tscPathBrowseButton.text=&Browse... 5 | TypeScriptOptionsPanel.tscPathSearchButton.text=S&earch... 6 | TypeScriptOptionsPanel.tscOutputOnErrorCheckBox.text=O&pen Output on Error 7 | TypeScriptOptionsPanel.tscDebugCheckBox.text=&Generate source maps 8 | -------------------------------------------------------------------------------- /src/main/java/org/netbeans/ts/lexer/ECMAScriptLanguage.java: -------------------------------------------------------------------------------- 1 | package org.netbeans.ts.lexer; 2 | 3 | import org.netbeans.api.lexer.Language; 4 | import org.netbeans.modules.csl.spi.DefaultLanguageConfig; 5 | import org.netbeans.modules.csl.spi.LanguageRegistration; 6 | 7 | @LanguageRegistration(mimeType = "text/x-ts") 8 | public class ECMAScriptLanguage extends DefaultLanguageConfig { 9 | 10 | @Override 11 | public Language getLexerLanguage() { 12 | return new ECMAScriptLanguageHierarchy().language(); 13 | } 14 | 15 | @Override 16 | public String getDisplayName() { 17 | return "ECMAScript"; 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /src/main/resources/org/netbeans/ts/FontAndColors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/main/java/org/netbeans/ts/lexer/ECMAScriptTokenId.java: -------------------------------------------------------------------------------- 1 | package org.netbeans.ts.lexer; 2 | 3 | import org.netbeans.api.lexer.TokenId; 4 | 5 | public class ECMAScriptTokenId implements TokenId { 6 | 7 | private final String name; 8 | private final String primaryCategory; 9 | private final int id; 10 | 11 | ECMAScriptTokenId(String name, String primaryCategory, int id) { 12 | this.name = name; 13 | this.primaryCategory = primaryCategory; 14 | this.id = id; 15 | } 16 | 17 | @Override 18 | public String primaryCategory() { 19 | return primaryCategory; 20 | } 21 | 22 | @Override 23 | public int ordinal() { 24 | return id; 25 | } 26 | 27 | @Override 28 | public String name() { 29 | return name; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/main/resources/org/netbeans/ts/layer.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /src/main/java/org/netbeans/ts/lexer/ECMAScriptNBLexer.java: -------------------------------------------------------------------------------- 1 | package org.netbeans.ts.lexer; 2 | 3 | import org.netbeans.api.lexer.Token; 4 | import org.netbeans.spi.lexer.Lexer; 5 | import org.netbeans.spi.lexer.LexerRestartInfo; 6 | 7 | class ECMAScriptNBLexer implements Lexer { 8 | 9 | private LexerRestartInfo info; 10 | 11 | private ECMAScriptLexer lexer; 12 | 13 | public ECMAScriptNBLexer(LexerRestartInfo info) { 14 | this.info = info; 15 | AntlrCharStream charStream = new AntlrCharStream(info.input(), "ECMAScriptEditor"); 16 | lexer = new ECMAScriptLexer(charStream); 17 | } 18 | 19 | @Override 20 | public Token nextToken() { 21 | org.antlr.v4.runtime.Token token = lexer.nextToken(); 22 | if (token.getType() != lexer.EOF) { 23 | ECMAScriptTokenId tokenId = ECMAScriptLanguageHierarchy.getToken(token.getType()); 24 | return info.tokenFactory().createToken(tokenId); 25 | } 26 | return null; 27 | } 28 | 29 | @Override 30 | public Object state() { 31 | return null; 32 | } 33 | 34 | @Override 35 | public void release() { 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/org/netbeans/ts/syntaxhighlighter/TsLanguageProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package org.netbeans.ts.syntaxhighlighter; 7 | 8 | import org.netbeans.api.lexer.InputAttributes; 9 | import org.netbeans.api.lexer.Language; 10 | import org.netbeans.api.lexer.LanguagePath; 11 | import org.netbeans.api.lexer.Token; 12 | import org.netbeans.spi.lexer.LanguageEmbedding; 13 | import org.netbeans.spi.lexer.LanguageProvider; 14 | 15 | /** 16 | * 17 | * @author denz 18 | */ 19 | @org.openide.util.lookup.ServiceProvider(service=org.netbeans.spi.lexer.LanguageProvider.class) 20 | public class TsLanguageProvider extends LanguageProvider { 21 | 22 | @Override 23 | public Language findLanguage(String string) { 24 | /* 25 | if ("text/x-cm".equals(mimeType)) { 26 | //return new CMinusLanguageHierarchy().language(); 27 | } 28 | */ 29 | 30 | return null; 31 | } 32 | 33 | @Override 34 | public LanguageEmbedding findLanguageEmbedding(Token token, LanguagePath lp, InputAttributes ia) { 35 | return null; //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/org/netbeans/ts/lexer/ECMAScriptLanguageHierarchy.java: -------------------------------------------------------------------------------- 1 | package org.netbeans.ts.lexer; 2 | 3 | import java.util.*; 4 | import org.netbeans.spi.lexer.LanguageHierarchy; 5 | import org.netbeans.spi.lexer.Lexer; 6 | import org.netbeans.spi.lexer.LexerRestartInfo; 7 | 8 | public class ECMAScriptLanguageHierarchy extends LanguageHierarchy { 9 | 10 | private static List tokens = new ArrayList(); 11 | private static Map idToToken = new HashMap(); 12 | 13 | static { 14 | TokenType[] tokenTypes = TokenType.values(); 15 | for (TokenType tokenType : tokenTypes) { 16 | tokens.add(new ECMAScriptTokenId(tokenType.name(), tokenType.category, tokenType.id)); 17 | } 18 | for (ECMAScriptTokenId token : tokens) { 19 | idToToken.put(token.ordinal(), token); 20 | } 21 | } 22 | 23 | static synchronized ECMAScriptTokenId getToken(int id) { 24 | return idToToken.get(id); 25 | } 26 | 27 | protected synchronized Collection createTokenIds() { 28 | return tokens; 29 | } 30 | 31 | protected synchronized Lexer createLexer(LexerRestartInfo info) { 32 | return new ECMAScriptNBLexer(info); 33 | } 34 | 35 | protected String mimeType() { 36 | return "text/x-ts"; 37 | } 38 | } -------------------------------------------------------------------------------- /src/main/java/org/netbeans/ts/completion/TsCompletionProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package org.netbeans.ts.completion; 7 | 8 | import java.util.ArrayList; 9 | import java.util.List; 10 | import java.util.Set; 11 | import javax.swing.ImageIcon; 12 | import org.netbeans.modules.csl.api.ElementKind; 13 | import org.netbeans.modules.csl.api.Modifier; 14 | import org.netbeans.api.editor.mimelookup.MimeRegistration; 15 | import org.netbeans.modules.csl.api.CodeCompletionContext; 16 | import org.netbeans.modules.csl.api.CompletionProposal; 17 | import org.netbeans.modules.csl.api.ElementHandle; 18 | import org.netbeans.modules.csl.spi.ParserResult; 19 | import org.netbeans.modules.javascript2.editor.spi.CompletionContext; 20 | import org.netbeans.modules.javascript2.editor.spi.CompletionProvider; 21 | 22 | /** 23 | * 24 | * @author denz 25 | */ 26 | //@MimeRegistration(mimeType = "text/x-ts", service = TsCompletionProvider.class) 27 | public class TsCompletionProvider implements CompletionProvider { 28 | 29 | @Override 30 | public List complete(CodeCompletionContext ccc, CompletionContext cc, String string) { 31 | return null; //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. 32 | } 33 | 34 | @Override 35 | public String getHelpDocumentation(ParserResult pr, ElementHandle eh) { 36 | return null; //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/org/netbeans/ts/TypeScriptCustomizer.java: -------------------------------------------------------------------------------- 1 | package org.netbeans.ts; 2 | 3 | import javax.swing.JComponent; 4 | import javax.swing.JPanel; 5 | import org.netbeans.api.project.Project; 6 | import org.netbeans.modules.javascript2.editor.api.FrameworksUtils; 7 | import org.netbeans.spi.project.ui.support.ProjectCustomizer; 8 | import org.openide.util.Lookup; 9 | import org.openide.util.NbBundle; 10 | 11 | /** 12 | * 13 | * @author Petr Pisl 14 | */ 15 | public class TypeScriptCustomizer implements ProjectCustomizer.CompositeCategoryProvider { 16 | 17 | @ProjectCustomizer.CompositeCategoryProvider.Registrations({ 18 | @ProjectCustomizer.CompositeCategoryProvider.Registration( 19 | projectType = FrameworksUtils.HTML5_CLIENT_PROJECT, 20 | category = FrameworksUtils.CATEGORY, 21 | position = 270 22 | ), 23 | @ProjectCustomizer.CompositeCategoryProvider.Registration( 24 | projectType = FrameworksUtils.PHP_PROJECT, 25 | category = FrameworksUtils.CATEGORY, 26 | position = 270 27 | ), 28 | @ProjectCustomizer.CompositeCategoryProvider.Registration( 29 | projectType = FrameworksUtils.MAVEN_PROJECT, 30 | category = FrameworksUtils.CATEGORY, 31 | position = 270 32 | ) 33 | }) 34 | 35 | public static TypeScriptCustomizer createCustomizer() { 36 | return new TypeScriptCustomizer(); 37 | } 38 | 39 | @NbBundle.Messages("TypeScriptCustomizer.displayName=TypeScript") 40 | @Override 41 | public ProjectCustomizer.Category createCategory(Lookup context) { 42 | return ProjectCustomizer.Category.create( 43 | "typescript", // NOI18N 44 | Bundle.TypeScriptCustomizer_displayName(), 45 | null, (ProjectCustomizer.Category[]) null); 46 | } 47 | 48 | @Override 49 | public JComponent createComponent(ProjectCustomizer.Category category, Lookup context) { 50 | Project project = context.lookup(Project.class); 51 | return new JPanel(); 52 | // return new RequireJsPanel(category, project); 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # TypeScript 2 | 3 | ## Specification for NetBeans Support for TypeScript 4 | 5 | A basic outline of features that are needed in order in which they are needed. 6 | 7 | All screenshots shown below are taken from the current state of this repo. 8 | 9 | ### Phase 1: Set up the GUI infrastructure 10 | 11 | #### (a) Extension to Project Properties dialog 12 | 13 | 14 | 15 | Similar to support for SASS and LESS, here the user will 16 | specify the folders in which TS files will be found 17 | and the matching folders where the JS should be generated. 18 | 19 | #### (b) Extension to Options window 20 | 21 | 22 | 23 | Similar to support for SASS and LESS, here the user will 24 | define the settings related to the TSC tool that will be 25 | used to generate the JS from the TS. 26 | 27 | ### Phase 2: Generate JavaScript from TS on Save 28 | 29 | Use tsc --sourcemap greeter.ts 30 | 31 | Using the settings returned from the GUI defined in Phase 1, 32 | automatically generate JS for the currently changed TS file. 33 | 34 | ### Phase 3: TypeScript Code Structures 35 | 36 | #### (a) Code Templates for TypeScript 37 | 38 | to be done 39 | 40 | #### (b) File Templates for TypeScript 41 | 42 | to be done 43 | 44 | #### (c) Project Templates for TypeScript 45 | 46 | 47 | 48 | ### Phase 4: TypeScript Editor 49 | 50 | #### (a) New File Type for TypeScript 51 | 52 | 53 | 54 | Phase 2 above assumes there is support for the TS file extension, 55 | i.e., TS files should be recognized and when there is a change, 56 | the JS should be generated. 57 | 58 | #### (b) Sytax Coloring for TypeScript 59 | 60 | 61 | 62 | A start has been made, as can be seen above. ANTLR lexer has been created, 63 | integrated, and a start has been made to setting syntax colorings, which 64 | can already be modified in the Options window. HTML editor will be embedded 65 | in relevant places, e.g., between quotation marks. 66 | 67 | The above is the start of a new editor for ECMAScript, making use of this ANTLR 68 | definition: https://raw.githubusercontent.com/antlr/grammars-v4/master/ecmascript/ECMAScript.g4. 69 | Because of the relationship between TypeScript and ECMAScript, 70 | an ECMAScript editor should be 71 | able to work equally well for TypeScript. 72 | 73 | #### (c) Code Completion for TypeScript 74 | 75 | to be done 76 | 77 | #### (d) Refactoring for TypeScript 78 | 79 | to be done 80 | 81 | ### Phase 5: TypeScript Debugger 82 | 83 | to be done 84 | 85 | -------------------------------------------------------------------------------- /src/main/java/org/netbeans/ts/samples/projects/greeter/GreeterWizardPanel.java: -------------------------------------------------------------------------------- 1 | package org.netbeans.ts.samples.projects.greeter; 2 | 3 | import java.awt.Component; 4 | import java.util.HashSet; 5 | import java.util.Set; 6 | import javax.swing.event.ChangeEvent; 7 | import javax.swing.event.ChangeListener; 8 | import org.openide.WizardDescriptor; 9 | import org.openide.WizardValidationException; 10 | import org.openide.util.HelpCtx; 11 | import org.openide.util.NbBundle; 12 | 13 | /** 14 | * Panel just asking for basic info. 15 | */ 16 | public class GreeterWizardPanel implements WizardDescriptor.Panel, 17 | WizardDescriptor.ValidatingPanel, WizardDescriptor.FinishablePanel { 18 | 19 | private WizardDescriptor wizardDescriptor; 20 | private GreeterPanelVisual component; 21 | 22 | public GreeterWizardPanel() { 23 | } 24 | 25 | public Component getComponent() { 26 | if (component == null) { 27 | component = new GreeterPanelVisual(this); 28 | component.setName(NbBundle.getMessage(GreeterWizardPanel.class, "LBL_CreateProjectStep")); 29 | } 30 | return component; 31 | } 32 | 33 | public HelpCtx getHelp() { 34 | return new HelpCtx(GreeterWizardPanel.class); 35 | } 36 | 37 | public boolean isValid() { 38 | getComponent(); 39 | return component.valid(wizardDescriptor); 40 | } 41 | 42 | private final Set listeners = new HashSet(1); // or can use ChangeSupport in NB 6.0 43 | 44 | public final void addChangeListener(ChangeListener l) { 45 | synchronized (listeners) { 46 | listeners.add(l); 47 | } 48 | } 49 | 50 | public final void removeChangeListener(ChangeListener l) { 51 | synchronized (listeners) { 52 | listeners.remove(l); 53 | } 54 | } 55 | 56 | protected final void fireChangeEvent() { 57 | Set ls; 58 | synchronized (listeners) { 59 | ls = new HashSet(listeners); 60 | } 61 | ChangeEvent ev = new ChangeEvent(this); 62 | for (ChangeListener l : ls) { 63 | l.stateChanged(ev); 64 | } 65 | } 66 | 67 | public void readSettings(Object settings) { 68 | wizardDescriptor = (WizardDescriptor) settings; 69 | component.read(wizardDescriptor); 70 | } 71 | 72 | public void storeSettings(Object settings) { 73 | WizardDescriptor d = (WizardDescriptor) settings; 74 | component.store(d); 75 | } 76 | 77 | public boolean isFinishPanel() { 78 | return true; 79 | } 80 | 81 | public void validate() throws WizardValidationException { 82 | getComponent(); 83 | component.validate(wizardDescriptor); 84 | } 85 | 86 | } 87 | -------------------------------------------------------------------------------- /src/main/java/org/netbeans/ts/options/TypeScriptOptionsPanelController.java: -------------------------------------------------------------------------------- 1 | package org.netbeans.ts.options; 2 | 3 | import java.beans.PropertyChangeListener; 4 | import java.beans.PropertyChangeSupport; 5 | import javax.swing.JComponent; 6 | import javax.swing.SwingUtilities; 7 | import org.netbeans.spi.options.OptionsPanelController; 8 | import org.openide.util.HelpCtx; 9 | import org.openide.util.Lookup; 10 | 11 | @OptionsPanelController.SubRegistration( 12 | location = "Html5", 13 | displayName = "#AdvancedOption_DisplayName_TypeScript", 14 | keywords = "#AdvancedOption_Keywords_TypeScript", 15 | keywordsCategory = "Html5/TypeScript" 16 | ) 17 | @org.openide.util.NbBundle.Messages({"AdvancedOption_DisplayName_TypeScript=TypeScript", "AdvancedOption_Keywords_TypeScript=TypeScript"}) 18 | public final class TypeScriptOptionsPanelController extends OptionsPanelController { 19 | 20 | private TypeScriptOptionsPanel panel; 21 | private final PropertyChangeSupport pcs = new PropertyChangeSupport(this); 22 | private boolean changed; 23 | 24 | @Override 25 | public void update() { 26 | getPanel().load(); 27 | changed = false; 28 | } 29 | 30 | @Override 31 | public void applyChanges() { 32 | SwingUtilities.invokeLater(new Runnable() { 33 | @Override 34 | public void run() { 35 | getPanel().store(); 36 | changed = false; 37 | } 38 | }); 39 | } 40 | 41 | public void cancel() { 42 | // need not do anything special, if no changes have been persisted yet 43 | } 44 | 45 | public boolean isValid() { 46 | return true; 47 | // return getPanel().valid(); 48 | } 49 | 50 | public boolean isChanged() { 51 | return changed; 52 | } 53 | 54 | public HelpCtx getHelpCtx() { 55 | return null; // new HelpCtx("...ID") if you have a help set 56 | } 57 | 58 | public JComponent getComponent(Lookup masterLookup) { 59 | return getPanel(); 60 | } 61 | 62 | public void addPropertyChangeListener(PropertyChangeListener l) { 63 | pcs.addPropertyChangeListener(l); 64 | } 65 | 66 | public void removePropertyChangeListener(PropertyChangeListener l) { 67 | pcs.removePropertyChangeListener(l); 68 | } 69 | 70 | private TypeScriptOptionsPanel getPanel() { 71 | if (panel == null) { 72 | panel = new TypeScriptOptionsPanel(); 73 | } 74 | return panel; 75 | } 76 | 77 | void changed() { 78 | if (!changed) { 79 | changed = true; 80 | pcs.firePropertyChange(OptionsPanelController.PROP_CHANGED, false, true); 81 | } 82 | pcs.firePropertyChange(OptionsPanelController.PROP_VALID, null, null); 83 | } 84 | 85 | } 86 | -------------------------------------------------------------------------------- /src/main/java/org/netbeans/ts/lexer/ECMAScriptLexer.tokens: -------------------------------------------------------------------------------- 1 | RegularExpressionLiteral=1 2 | LineTerminator=2 3 | OpenBracket=3 4 | CloseBracket=4 5 | OpenParen=5 6 | CloseParen=6 7 | OpenBrace=7 8 | CloseBrace=8 9 | SemiColon=9 10 | Comma=10 11 | Assign=11 12 | QuestionMark=12 13 | Colon=13 14 | Dot=14 15 | PlusPlus=15 16 | MinusMinus=16 17 | Plus=17 18 | Minus=18 19 | BitNot=19 20 | Not=20 21 | Multiply=21 22 | Divide=22 23 | Modulus=23 24 | RightShiftArithmetic=24 25 | LeftShiftArithmetic=25 26 | RightShiftLogical=26 27 | LessThan=27 28 | MoreThan=28 29 | LessThanEquals=29 30 | GreaterThanEquals=30 31 | Equals=31 32 | NotEquals=32 33 | IdentityEquals=33 34 | IdentityNotEquals=34 35 | BitAnd=35 36 | BitXOr=36 37 | BitOr=37 38 | And=38 39 | Or=39 40 | MultiplyAssign=40 41 | DivideAssign=41 42 | ModulusAssign=42 43 | PlusAssign=43 44 | MinusAssign=44 45 | LeftShiftArithmeticAssign=45 46 | RightShiftArithmeticAssign=46 47 | RightShiftLogicalAssign=47 48 | BitAndAssign=48 49 | BitXorAssign=49 50 | BitOrAssign=50 51 | NullLiteral=51 52 | BooleanLiteral=52 53 | DecimalLiteral=53 54 | HexIntegerLiteral=54 55 | OctalIntegerLiteral=55 56 | Break=56 57 | Do=57 58 | Instanceof=58 59 | Typeof=59 60 | Case=60 61 | Else=61 62 | New=62 63 | Var=63 64 | Catch=64 65 | Finally=65 66 | Return=66 67 | Void=67 68 | Continue=68 69 | For=69 70 | Switch=70 71 | While=71 72 | Debugger=72 73 | Function=73 74 | This=74 75 | With=75 76 | Default=76 77 | If=77 78 | Throw=78 79 | Delete=79 80 | In=80 81 | Try=81 82 | Class=82 83 | Enum=83 84 | Extends=84 85 | Super=85 86 | Const=86 87 | Export=87 88 | Import=88 89 | Implements=89 90 | Let=90 91 | Private=91 92 | Public=92 93 | Interface=93 94 | Package=94 95 | Protected=95 96 | Static=96 97 | Yield=97 98 | Identifier=98 99 | StringLiteral=99 100 | WhiteSpaces=100 101 | MultiLineComment=101 102 | SingleLineComment=102 103 | UnexpectedCharacter=103 104 | '['=3 105 | ']'=4 106 | '('=5 107 | ')'=6 108 | '{'=7 109 | '}'=8 110 | ';'=9 111 | ','=10 112 | '='=11 113 | '?'=12 114 | ':'=13 115 | '.'=14 116 | '++'=15 117 | '--'=16 118 | '+'=17 119 | '-'=18 120 | '~'=19 121 | '!'=20 122 | '*'=21 123 | '/'=22 124 | '%'=23 125 | '>>'=24 126 | '<<'=25 127 | '>>>'=26 128 | '<'=27 129 | '>'=28 130 | '<='=29 131 | '>='=30 132 | '=='=31 133 | '!='=32 134 | '==='=33 135 | '!=='=34 136 | '&'=35 137 | '^'=36 138 | '|'=37 139 | '&&'=38 140 | '||'=39 141 | '*='=40 142 | '/='=41 143 | '%='=42 144 | '+='=43 145 | '-='=44 146 | '<<='=45 147 | '>>='=46 148 | '>>>='=47 149 | '&='=48 150 | '^='=49 151 | '|='=50 152 | 'null'=51 153 | 'break'=56 154 | 'do'=57 155 | 'instanceof'=58 156 | 'typeof'=59 157 | 'case'=60 158 | 'else'=61 159 | 'new'=62 160 | 'var'=63 161 | 'catch'=64 162 | 'finally'=65 163 | 'return'=66 164 | 'void'=67 165 | 'continue'=68 166 | 'for'=69 167 | 'switch'=70 168 | 'while'=71 169 | 'debugger'=72 170 | 'function'=73 171 | 'this'=74 172 | 'with'=75 173 | 'default'=76 174 | 'if'=77 175 | 'throw'=78 176 | 'delete'=79 177 | 'in'=80 178 | 'try'=81 179 | 'class'=82 180 | 'enum'=83 181 | 'extends'=84 182 | 'super'=85 183 | 'const'=86 184 | 'export'=87 185 | 'import'=88 186 | -------------------------------------------------------------------------------- /src/main/java/org/netbeans/ts/options/StringUtils.java: -------------------------------------------------------------------------------- 1 | package org.netbeans.ts.options; 2 | 3 | import java.util.Arrays; 4 | import java.util.Collection; 5 | import java.util.Collections; 6 | import java.util.List; 7 | import java.util.regex.Pattern; 8 | import org.netbeans.api.annotations.common.NullAllowed; 9 | import org.openide.util.Parameters; 10 | 11 | // XXX copied from SASS, where it was copied from PHP 12 | /** 13 | * Miscellaneous string utilities. 14 | */ 15 | public final class StringUtils { 16 | 17 | private StringUtils() { 18 | } 19 | 20 | /** 21 | * Return true if the String is not null 22 | * and has any character after trimming. 23 | * @param input input String, can be null. 24 | * @return true if the String is not null 25 | * and has any character after trimming. 26 | * @see #isEmpty(String) 27 | */ 28 | public static boolean hasText(String input) { 29 | return input != null && !input.trim().isEmpty(); 30 | } 31 | 32 | /** 33 | * Return true if the String is null 34 | * or has no characters. 35 | * @param input input String, can be null 36 | * @return true if the String is null 37 | * or has no characters 38 | * @see #hasText(String) 39 | */ 40 | public static boolean isEmpty(String input) { 41 | return input == null || input.isEmpty(); 42 | } 43 | 44 | /** 45 | * Implode collection of strings to one string using delimiter. 46 | * @param items collection of strings to be imploded, can be empty (but not null) 47 | * @param delimiter delimiter to be used 48 | * @return one string of imploded strings using delimiter, never null 49 | * @see #explode(String, String) 50 | * @since 2.14 51 | */ 52 | public static String implode(Collection items, String delimiter) { 53 | Parameters.notNull("items", items); 54 | Parameters.notNull("delimiter", delimiter); 55 | 56 | if (items.isEmpty()) { 57 | return ""; // NOI18N 58 | } 59 | 60 | StringBuilder buffer = new StringBuilder(200); 61 | boolean first = true; 62 | for (String s : items) { 63 | if (!first) { 64 | buffer.append(delimiter); 65 | } 66 | buffer.append(s); 67 | first = false; 68 | } 69 | return buffer.toString(); 70 | } 71 | 72 | /** 73 | * Explode the string using the delimiter. 74 | * @param string string to be exploded, can be null 75 | * @param delimiter delimiter to be used, cannot be empty string 76 | * @return list of exploded strings using delimiter 77 | * @see #implode(List, String) 78 | */ 79 | public static List explode(@NullAllowed String string, String delimiter) { 80 | Parameters.notEmpty("delimiter", delimiter); // NOI18N 81 | 82 | if (!hasText(string)) { 83 | return Collections.emptyList(); 84 | } 85 | assert string != null; 86 | return Arrays.asList(string.split(Pattern.quote(delimiter))); 87 | } 88 | 89 | } 90 | -------------------------------------------------------------------------------- /src/main/java/org/netbeans/ts/filetype/TsDataObject.java: -------------------------------------------------------------------------------- 1 | package org.netbeans.ts.filetype; 2 | 3 | import java.io.IOException; 4 | import org.openide.awt.ActionID; 5 | import org.openide.awt.ActionReference; 6 | import org.openide.awt.ActionReferences; 7 | import org.openide.filesystems.FileObject; 8 | import org.openide.filesystems.MIMEResolver; 9 | import org.openide.loaders.DataObject; 10 | import org.openide.loaders.DataObjectExistsException; 11 | import org.openide.loaders.MultiDataObject; 12 | import org.openide.loaders.MultiFileLoader; 13 | import org.openide.util.Lookup; 14 | import org.openide.util.NbBundle.Messages; 15 | import org.openide.windows.TopComponent; 16 | 17 | @Messages({ 18 | "LBL_Ts_LOADER=Files of Ts" 19 | }) 20 | @MIMEResolver.ExtensionRegistration( 21 | displayName = "#LBL_Ts_LOADER", 22 | mimeType = "text/x-ts", 23 | extension = {"ts"} 24 | ) 25 | @DataObject.Registration( 26 | mimeType = "text/x-ts", 27 | iconBase = "org/netbeans/ts/filetype/ts.png", 28 | displayName = "#LBL_Ts_LOADER", 29 | position = 300 30 | ) 31 | @ActionReferences({ 32 | @ActionReference( 33 | path = "Loaders/text/x-ts/Actions", 34 | id = @ActionID(category = "System", id = "org.openide.actions.OpenAction"), 35 | position = 100, 36 | separatorAfter = 200 37 | ), 38 | @ActionReference( 39 | path = "Loaders/text/x-ts/Actions", 40 | id = @ActionID(category = "Edit", id = "org.openide.actions.CutAction"), 41 | position = 300 42 | ), 43 | @ActionReference( 44 | path = "Loaders/text/x-ts/Actions", 45 | id = @ActionID(category = "Edit", id = "org.openide.actions.CopyAction"), 46 | position = 400, 47 | separatorAfter = 500 48 | ), 49 | @ActionReference( 50 | path = "Loaders/text/x-ts/Actions", 51 | id = @ActionID(category = "Edit", id = "org.openide.actions.DeleteAction"), 52 | position = 600 53 | ), 54 | @ActionReference( 55 | path = "Loaders/text/x-ts/Actions", 56 | id = @ActionID(category = "System", id = "org.openide.actions.RenameAction"), 57 | position = 700, 58 | separatorAfter = 800 59 | ), 60 | @ActionReference( 61 | path = "Loaders/text/x-ts/Actions", 62 | id = @ActionID(category = "System", id = "org.openide.actions.SaveAsTemplateAction"), 63 | position = 900, 64 | separatorAfter = 1000 65 | ), 66 | @ActionReference( 67 | path = "Loaders/text/x-ts/Actions", 68 | id = @ActionID(category = "System", id = "org.openide.actions.FileSystemAction"), 69 | position = 1100, 70 | separatorAfter = 1200 71 | ), 72 | @ActionReference( 73 | path = "Loaders/text/x-ts/Actions", 74 | id = @ActionID(category = "System", id = "org.openide.actions.ToolsAction"), 75 | position = 1300 76 | ), 77 | @ActionReference( 78 | path = "Loaders/text/x-ts/Actions", 79 | id = @ActionID(category = "System", id = "org.openide.actions.PropertiesAction"), 80 | position = 1400 81 | ) 82 | }) 83 | public class TsDataObject extends MultiDataObject { 84 | 85 | public TsDataObject(FileObject pf, MultiFileLoader loader) throws DataObjectExistsException, IOException { 86 | super(pf, loader); 87 | registerEditor("text/x-ts", false); 88 | } 89 | 90 | @Override 91 | protected int associateLookup() { 92 | return 1; 93 | } 94 | 95 | } 96 | -------------------------------------------------------------------------------- /src/main/java/org/netbeans/ts/JSOnSaveHook.java: -------------------------------------------------------------------------------- 1 | package org.netbeans.ts; 2 | 3 | import java.io.IOException; 4 | import java.util.concurrent.ExecutionException; 5 | import java.util.concurrent.Future; 6 | import java.util.concurrent.atomic.AtomicBoolean; 7 | import javax.swing.text.Document; 8 | import org.netbeans.api.editor.mimelookup.MimeRegistration; 9 | import org.netbeans.api.extexecution.ExecutionDescriptor; 10 | import org.netbeans.api.extexecution.ExecutionService; 11 | import org.netbeans.api.extexecution.ExternalProcessBuilder; 12 | import org.netbeans.spi.editor.document.OnSaveTask; 13 | import org.netbeans.ts.options.TypeScriptOptionsPanel; 14 | import org.openide.awt.StatusDisplayer; 15 | import org.openide.filesystems.FileObject; 16 | import org.openide.loaders.DataObject; 17 | import org.openide.util.Exceptions; 18 | import org.openide.util.NbPreferences; 19 | 20 | public class JSOnSaveHook implements OnSaveTask { 21 | 22 | private final Document document; 23 | 24 | private final AtomicBoolean canceled = new AtomicBoolean(); 25 | 26 | public JSOnSaveHook(Document doc) { 27 | this.document = doc; 28 | } 29 | 30 | @Override 31 | public void performTask() { 32 | StatusDisplayer.getDefault().setStatusText("Transpile to TypeScript...",10); 33 | String tscPath = NbPreferences.forModule(TypeScriptOptionsPanel.class).get("tscPath", ""); 34 | execute(tscPath, getFileObject(document)); 35 | } 36 | 37 | public FileObject getFileObject(Document doc) { 38 | Object sdp = doc.getProperty(Document.StreamDescriptionProperty); 39 | if (sdp instanceof FileObject) { 40 | return (FileObject) sdp; 41 | } 42 | if (sdp instanceof DataObject) { 43 | return ((DataObject) sdp).getPrimaryFile(); 44 | } 45 | return null; 46 | } 47 | 48 | public Integer execute(final String tscPath, FileObject fo) { 49 | Integer get = null; 50 | ExecutionDescriptor descriptor = new ExecutionDescriptor(). 51 | showProgress(true). 52 | frontWindow(true). 53 | controllable(true); 54 | ExternalProcessBuilder processBuilder = new ExternalProcessBuilder( 55 | tscPath) 56 | //hardcoded: 57 | // "C:\\Users\\gwieleng\\AppData\\Roaming\\npm\\tsc.cmd") 58 | .addArgument("--sourcemap") 59 | .addArgument(fo.getPath()); 60 | //based on the code below, keeping it for inspiration: 61 | // ExternalProcessBuilder processBuilder = new ExternalProcessBuilder(path) 62 | // .addArgument("-o").addArgument(fo.getParent().getPath() + "/" + fo.getName() + ".dart.js") 63 | // .addArgument("--minify") 64 | // .addArgument(fo.getPath()); 65 | ExecutionService service = ExecutionService.newService(processBuilder, descriptor, tscPath); 66 | Future task = service.run(); 67 | try { 68 | get = task.get(); 69 | } catch (InterruptedException ex) { 70 | Exceptions.printStackTrace(ex); 71 | } catch (ExecutionException ex) { 72 | Exceptions.printStackTrace(ex); 73 | } 74 | return get; 75 | } 76 | 77 | @Override 78 | public void runLocked(Runnable r) { 79 | r.run(); 80 | } 81 | 82 | @Override 83 | public boolean cancel() { 84 | canceled.set(true); 85 | return true; 86 | } 87 | 88 | @MimeRegistration(mimeType = "text/x-ts", service = OnSaveTask.Factory.class, position = 1) 89 | public static final class FactoryImpl implements Factory { 90 | @Override 91 | public OnSaveTask createTask(Context context) { 92 | return new JSOnSaveHook(context.getDocument()); 93 | } 94 | } 95 | 96 | } 97 | -------------------------------------------------------------------------------- /src/main/java/org/netbeans/ts/lexer/TokenType.java: -------------------------------------------------------------------------------- 1 | package org.netbeans.ts.lexer; 2 | 3 | public enum TokenType { 4 | 5 | RegularExpressionLiteral(1, "string"), 6 | LineTerminator(2, "line-break"), 7 | OpenBracket(3, "keyword"), 8 | CloseBracket(4, "keyword"), 9 | OpenParen(5, "keyword"), 10 | CloseParen(6, "keyword"), 11 | OpenBrace(7, "keyword"), 12 | CloseBrace(8, "keyword"), 13 | SemiColon(9, "keyword"), 14 | Comma(10, "keyword"), 15 | Assign(11, "keyword"), 16 | QuestionMark(12, "keyword"), 17 | Colon(13, "keyword"), 18 | Dot(14, "keyword"), 19 | PlusPlus(15, "keyword"), 20 | MinusMinus(16, "keyword"), 21 | Plus(17, "keyword"), 22 | Minus(18, "keyword"), 23 | BitNot(19, "keyword"), 24 | Not(20, "keyword"), 25 | Multiply(21, "keyword"), 26 | Divide(22, "keyword"), 27 | Modulus(23, "keyword"), 28 | RightShiftArithmetic(24, "keyword"), 29 | LeftShiftArithmetic(25, "keyword"), 30 | RightShiftLogical(26, "keyword"), 31 | LessThan(27, "keyword"), 32 | MoreThan(28, "keyword"), 33 | LessThanEquals(29, "keyword"), 34 | GreaterThanEquals(30, "keyword"), 35 | Equals(31, "keyword"), 36 | NotEquals(32, "keyword"), 37 | IdentityEquals(33, "keyword"), 38 | IdentityNotEquals(34, "keyword"), 39 | BitAnd(35, "keyword"), 40 | BitXOr(36, "keyword"), 41 | BitOr(37, "keyword"), 42 | And(38, "keyword"), 43 | Or(39, "keyword"), 44 | MultiplyAssign(40, "keyword"), 45 | DivideAssign(41, "keyword"), 46 | ModulusAssign(42, "keyword"), 47 | PlusAssign(43, "keyword"), 48 | MinusAssign(44, "keyword"), 49 | LeftShiftArithmeticAssign(45, "keyword"), 50 | RightShiftArithmeticAssign(46, "keyword"), 51 | RightShiftLogicalAssign(47, "keyword"), 52 | BitAndAssign(48, "keyword"), 53 | BitXorAssign(49, "keyword"), 54 | BitOrAssign(50, "keyword"), 55 | NullLiteral(51, "keyword"), 56 | BooleanLiteral(52, "keyword"), 57 | DecimalLiteral(53, "keyword"), 58 | HexIntegerLiteral(54, "keyword"), 59 | OctalIntegerLiteral(55, "keyword"), 60 | Break(56, "keyword"), 61 | Do(57, "keyword"), 62 | Instanceof(58, "keyword"), 63 | Typeof(59, "keyword"), 64 | Case(60, "keyword"), 65 | Else(61, "keyword"), 66 | New(62, "keyword"), 67 | Var(63, "var"), 68 | Catch(64, "keyword"), 69 | Finally(65, "keyword"), 70 | Return(66, "keyword"), 71 | Void(67, "keyword"), 72 | Continue(68, "keyword"), 73 | For(69, "keyword"), 74 | Switch(70, "keyword"), 75 | While(71, "keyword"), 76 | Debugger(72, "keyword"), 77 | Function(73, "function"), 78 | This(74, "keyword"), 79 | With(75, "keyword"), 80 | Default(76, "keyword"), 81 | If(77, "keyword"), 82 | Throw(78, "keyword"), 83 | Delete(79, "keyword"), 84 | In(80, "keyword"), 85 | Try(81, "keyword"), 86 | Class(82, "class"), 87 | Enum(83, "keyword"), 88 | Extends(84, "keyword"), 89 | Super(85, "keyword"), 90 | Const(86, "constructor"), 91 | Export(87, "keyword"), 92 | Import(88, "keyword"), 93 | Implements(89, "keyword"), 94 | Let(90, "keyword"), 95 | Public(92, "keyword"), 96 | Interface(93, "keyword"), 97 | Package(94, "keyword"), 98 | Protected(95, "keyword"), 99 | Static(96, "keyword"), 100 | Yield(97, "keyword"), 101 | Identifier(98, "identifier"), 102 | StringLiteral(99, "string"), 103 | WhiteSpaces(100, "keyword"), 104 | MultiLineComment(101, "comment"), 105 | SingleLineComment(102, "comment"), 106 | UnexpectedCharacter(103, "keyword"); 107 | 108 | public int id; 109 | public String category; 110 | public String text; 111 | 112 | private TokenType(int id, String category) { 113 | this.id = id; 114 | this.category = category; 115 | } 116 | 117 | public static TokenType valueOf(int id) { 118 | TokenType[] values = values(); 119 | for (TokenType value : values) { 120 | if (value.id == id) { 121 | return value; 122 | } 123 | } 124 | throw new IllegalArgumentException("The id " + id + " is not recognized"); 125 | } 126 | } 127 | -------------------------------------------------------------------------------- /src/main/java/org/netbeans/ts/lexer/AntlrCharStream.java: -------------------------------------------------------------------------------- 1 | package org.netbeans.ts.lexer; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | import org.antlr.v4.runtime.CharStream; 6 | import org.antlr.v4.runtime.misc.Interval; 7 | import org.netbeans.spi.lexer.LexerInput; 8 | 9 | /** 10 | * @author jonny 11 | */ 12 | public class AntlrCharStream implements CharStream { 13 | 14 | @Override 15 | public String getText(Interval intrvl) { 16 | throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. 17 | } 18 | 19 | private class CharStreamState { 20 | int index; 21 | int line; 22 | int charPositionInLine; 23 | } 24 | 25 | private int line = 1; 26 | private int charPositionInLine = 0; 27 | private LexerInput input; 28 | private String name; 29 | private int index = 0; 30 | private List markers; 31 | private int markDepth = 0; 32 | private int lastMarker; 33 | 34 | public AntlrCharStream(LexerInput input, String name) { 35 | this.input = input; 36 | this.name = name; 37 | } 38 | 39 | public String substring(int start, int stop) { 40 | return "hello"; 41 | } 42 | 43 | public int LT(int i) { 44 | return LA(i); 45 | } 46 | 47 | public int getLine() { 48 | return line; 49 | } 50 | 51 | public void setLine(int line) { 52 | this.line = line; 53 | } 54 | 55 | public void setCharPositionInLine(int pos) { 56 | this.charPositionInLine = pos; 57 | } 58 | 59 | public int getCharPositionInLine() { 60 | return charPositionInLine; 61 | } 62 | 63 | public void consume() { 64 | int c = input.read(); 65 | index++; 66 | charPositionInLine++; 67 | 68 | if (c == '\n') { 69 | line++; 70 | charPositionInLine = 0; 71 | } 72 | } 73 | 74 | public int LA(int i) { 75 | if (i == 0) { 76 | return 0; // undefined 77 | } 78 | 79 | int c = 0; 80 | for (int j = 0; j < i; j++) { 81 | c = read(); 82 | } 83 | backup(i); 84 | return c; 85 | } 86 | 87 | public int mark() { 88 | if (markers == null) { 89 | markers = new ArrayList(); 90 | markers.add(null); // depth 0 means no backtracking, leave blank 91 | } 92 | markDepth++; 93 | CharStreamState state = null; 94 | if (markDepth >= markers.size()) { 95 | state = new CharStreamState(); 96 | markers.add(state); 97 | } else { 98 | state = (CharStreamState) markers.get(markDepth); 99 | } 100 | state.index = index; 101 | state.line = line; 102 | state.charPositionInLine = charPositionInLine; 103 | lastMarker = markDepth; 104 | 105 | return markDepth; 106 | } 107 | 108 | public void rewind() { 109 | rewind(lastMarker); 110 | } 111 | 112 | public void rewind(int marker) { 113 | CharStreamState state = (CharStreamState) markers.get(marker); 114 | // restore stream state 115 | seek(state.index); 116 | line = state.line; 117 | charPositionInLine = state.charPositionInLine; 118 | release(marker); 119 | } 120 | 121 | public void release(int marker) { 122 | // unwind any other markers made after m and release m 123 | markDepth = marker; 124 | // release this marker 125 | markDepth--; 126 | } 127 | 128 | public void seek(int index) { 129 | if (index < this.index) { 130 | backup(this.index - index); 131 | this.index = index; // just jump; don't update stream state (line, ...) 132 | return; 133 | } 134 | 135 | // seek forward, consume until p hits index 136 | while (this.index < index) { 137 | consume(); 138 | } 139 | } 140 | 141 | public int index() { 142 | return index; 143 | } 144 | 145 | public int size() { 146 | return -1; //unknown... 147 | } 148 | 149 | public String getSourceName() { 150 | return name; 151 | } 152 | 153 | private int read() { 154 | int result = input.read(); 155 | if (result == LexerInput.EOF) { 156 | result = CharStream.EOF; 157 | } 158 | 159 | return result; 160 | } 161 | 162 | private void backup(int count) { 163 | input.backup(count); 164 | } 165 | } -------------------------------------------------------------------------------- /src/main/java/org/netbeans/ts/options/FileUtils.java: -------------------------------------------------------------------------------- 1 | package org.netbeans.ts.options; 2 | 3 | import java.io.File; 4 | import java.util.ArrayList; 5 | import java.util.Arrays; 6 | import java.util.Collections; 7 | import java.util.LinkedHashSet; 8 | import java.util.List; 9 | import java.util.Set; 10 | import java.util.logging.Level; 11 | import java.util.logging.Logger; 12 | import org.netbeans.api.annotations.common.CheckForNull; 13 | import org.openide.filesystems.FileUtil; 14 | import org.openide.util.NbBundle; 15 | import org.openide.util.Parameters; 16 | import org.openide.util.Utilities; 17 | 18 | // XXX copied from PHP 19 | public final class FileUtils { 20 | 21 | private static final Logger LOGGER = Logger.getLogger(FileUtils.class.getName()); 22 | 23 | private static final boolean IS_WINDOWS = Utilities.isWindows(); 24 | 25 | 26 | private FileUtils() { 27 | } 28 | 29 | /** 30 | * Find all the files (absolute path) with the given "filename" on user's PATH. 31 | *

32 | * This method is suitable for *nix as well as windows. 33 | * @param filename the name of a file to find. 34 | * @return list of absolute paths of found files. 35 | * @see #findFileOnUsersPath(String[]) 36 | */ 37 | public static List findFileOnUsersPath(String filename) { 38 | Parameters.notNull("filename", filename); // NOI18N 39 | return findFileOnUsersPath(new String[]{filename}); 40 | } 41 | 42 | /** 43 | * Find all the files (absolute path) with the given "filename" on user's PATH. 44 | *

45 | * This method is suitable for *nix as well as windows. 46 | * @param filenames the name of a file to find, more names can be provided. 47 | * @return list of absolute paths of found files (order preserved according to input names). 48 | * @see #findFileOnUsersPath(String) 49 | */ 50 | public static List findFileOnUsersPath(String... filenames) { 51 | Parameters.notNull("filenames", filenames); // NOI18N 52 | 53 | String path = System.getenv("PATH"); // NOI18N 54 | LOGGER.log(Level.FINE, "PATH: [{0}]", path); 55 | if (path == null) { 56 | return Collections.emptyList(); 57 | } 58 | // on linux there are usually duplicities in PATH 59 | Set dirs = new LinkedHashSet<>(Arrays.asList(path.split(File.pathSeparator))); 60 | LOGGER.log(Level.FINE, "PATH dirs: {0}", dirs); 61 | List found = new ArrayList<>(dirs.size() * filenames.length); 62 | for (String filename : filenames) { 63 | Parameters.notNull("filename", filename); // NOI18N 64 | for (String dir : dirs) { 65 | File file = new File(dir, filename); 66 | if (file.isFile()) { 67 | String absolutePath = FileUtil.normalizeFile(file).getAbsolutePath(); 68 | LOGGER.log(Level.FINE, "File ''{0}'' found", absolutePath); 69 | // not optimal but should be ok 70 | if (!found.contains(absolutePath)) { 71 | LOGGER.log(Level.FINE, "File ''{0}'' added to found files", absolutePath); 72 | found.add(absolutePath); 73 | } 74 | } 75 | } 76 | } 77 | LOGGER.log(Level.FINE, "Found files: {0}", found); 78 | return found; 79 | } 80 | 81 | /** 82 | * Validate a file path and return {@code null} if it is valid, otherwise an error. 83 | *

84 | * This method simply calls {@link #validateFile(String, String, boolean)} with "File" 85 | * (localized) as a {@code source}. 86 | * @param filePath a file path to validate 87 | * @param writable {@code true} if the file must be writable, {@code false} otherwise 88 | * @return {@code null} if it is valid, otherwise an error 89 | * @see #validateFile(String, String, boolean) 90 | */ 91 | @NbBundle.Messages("FileUtils.validateFile.file=File") 92 | @CheckForNull 93 | public static String validateFile(String filePath, boolean writable) { 94 | return validateFile(Bundle.FileUtils_validateFile_file(), filePath, writable); 95 | } 96 | 97 | /** 98 | * Validate a file path and return {@code null} if it is valid, otherwise an error. 99 | *

100 | * A valid file means that the filePath represents a valid, readable file 101 | * with absolute file path. 102 | * @param source source used in error message (e.g. "Script", "Config file") 103 | * @param filePath a file path to validate 104 | * @param writable {@code true} if the file must be writable, {@code false} otherwise 105 | * @return {@code null} if it is valid, otherwise an error 106 | */ 107 | @NbBundle.Messages({ 108 | "# {0} - source", 109 | "FileUtils.validateFile.missing={0} must be selected.", 110 | "# {0} - source", 111 | "FileUtils.validateFile.notAbsolute={0} must be an absolute path.", 112 | "# {0} - source", 113 | "FileUtils.validateFile.notFile={0} must be a valid file.", 114 | "# {0} - source", 115 | "FileUtils.validateFile.notReadable={0} is not readable.", 116 | "# {0} - source", 117 | "FileUtils.validateFile.notWritable={0} is not writable." 118 | }) 119 | @CheckForNull 120 | public static String validateFile(String source, String filePath, boolean writable) { 121 | if (!StringUtils.hasText(filePath)) { 122 | return Bundle.FileUtils_validateFile_missing(source); 123 | } 124 | 125 | File file = new File(filePath); 126 | if (!file.isAbsolute()) { 127 | return Bundle.FileUtils_validateFile_notAbsolute(source); 128 | } else if (!file.isFile()) { 129 | return Bundle.FileUtils_validateFile_notFile(source); 130 | } else if (!file.canRead()) { 131 | return Bundle.FileUtils_validateFile_notReadable(source); 132 | } else if (writable && !file.canWrite()) { 133 | return Bundle.FileUtils_validateFile_notWritable(source); 134 | } 135 | return null; 136 | } 137 | 138 | /** 139 | * Get the OS-dependent script extension. 140 | *

    Currently it returns (for dotted version): 141 | *
  • .bat on Windows 142 | *
  • .sh anywhere else 143 | *
144 | * @param withDot return "." as well, e.g. .sh 145 | * @return the OS-dependent script extension 146 | */ 147 | public static String getScriptExtension(boolean withDot, boolean cmdInsteadBatOnWin) { 148 | StringBuilder sb = new StringBuilder(4); 149 | if (withDot) { 150 | sb.append("."); // NOI18N 151 | } 152 | if (IS_WINDOWS) { 153 | sb.append(cmdInsteadBatOnWin ? "cmd" : "bat"); // NOI18N 154 | } else { 155 | sb.append("sh"); // NOI18N 156 | } 157 | return sb.toString(); 158 | } 159 | 160 | } 161 | -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4.0.0 4 | org.netbeans 5 | TypeScript 6 | 1.0-SNAPSHOT 7 | nbm 8 | 9 | 10 | 11 | org.codehaus.mojo 12 | nbm-maven-plugin 13 | 3.14 14 | true 15 | 16 | 17 | 18 | org.netbeans.modules:org-netbeans-modules-javascript2-editor 19 | impl 20 | org.netbeans.modules.javascript2.editor/1 = 201508041349 21 | 22 | 23 | 24 | 25 | 26 | org.apache.maven.plugins 27 | maven-compiler-plugin 28 | 2.5.1 29 | 30 | 1.7 31 | 1.7 32 | 33 | 34 | 35 | org.apache.maven.plugins 36 | maven-jar-plugin 37 | 2.4 38 | 39 | true 40 | 41 | 42 | 43 | 44 | 45 | 46 | netbeans 47 | Repository hosting NetBeans modules 48 | http://bits.netbeans.org/nexus/content/groups/netbeans 49 | 50 | false 51 | 52 | 53 | 54 | 55 | 56 | org.netbeans.api 57 | org-netbeans-api-annotations-common 58 | RELEASE802 59 | 60 | 61 | org.netbeans.api 62 | org-openide-util 63 | RELEASE802 64 | jar 65 | 66 | 67 | org.netbeans.api 68 | org-netbeans-modules-projectuiapi 69 | RELEASE802 70 | jar 71 | 72 | 73 | org.netbeans.api 74 | org-netbeans-modules-projectapi 75 | RELEASE802 76 | 77 | 78 | org.netbeans.modules 79 | org-netbeans-modules-javascript2-editor 80 | RELEASE802 81 | jar 82 | 83 | 84 | org.netbeans.api 85 | org-openide-util-lookup 86 | RELEASE802 87 | 88 | 89 | org.netbeans.api 90 | org-netbeans-modules-options-api 91 | RELEASE802 92 | 93 | 94 | org.netbeans.api 95 | org-openide-awt 96 | RELEASE802 97 | 98 | 99 | org.netbeans.api 100 | org-openide-filesystems 101 | RELEASE802 102 | 103 | 104 | org.netbeans.api 105 | org-openide-loaders 106 | RELEASE802 107 | 108 | 109 | org.netbeans.api 110 | org-openide-nodes 111 | RELEASE802 112 | 113 | 114 | org.netbeans.api 115 | org-openide-windows 116 | RELEASE802 117 | 118 | 119 | org.netbeans.api 120 | org-openide-text 121 | RELEASE802 122 | 123 | 124 | org.netbeans.api 125 | org-openide-dialogs 126 | RELEASE802 127 | 128 | 129 | org.netbeans.api 130 | org-netbeans-modules-editor-mimelookup 131 | RELEASE802 132 | 133 | 134 | org.netbeans.api 135 | org-netbeans-modules-editor-lib2 136 | RELEASE802 137 | 138 | 139 | org.netbeans.api 140 | org-netbeans-modules-extexecution 141 | RELEASE802 142 | 143 | 144 | org.antlr 145 | antlr4-runtime 146 | 4.5.1 147 | jar 148 | 149 | 150 | org.netbeans.api 151 | org-netbeans-modules-lexer 152 | RELEASE802 153 | 154 | 155 | org.netbeans.api 156 | org-netbeans-modules-csl-api 157 | RELEASE802 158 | 159 | 160 | org.netbeans.modules 161 | org-netbeans-modules-editor-errorstripe 162 | RELEASE802 163 | 164 | 165 | 166 | UTF-8 167 | 168 | 169 | -------------------------------------------------------------------------------- /src/main/java/org/netbeans/ts/samples/projects/greeter/GreeterPanelVisual.form: -------------------------------------------------------------------------------- 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 | -------------------------------------------------------------------------------- /src/main/java/org/netbeans/ts/options/TypeScriptOptionsPanel.form: -------------------------------------------------------------------------------- 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 | -------------------------------------------------------------------------------- /src/main/java/org/netbeans/ts/samples/projects/greeter/GreeterWizardIterator.java: -------------------------------------------------------------------------------- 1 | package org.netbeans.ts.samples.projects.greeter; 2 | 3 | import java.awt.Component; 4 | import java.io.ByteArrayInputStream; 5 | import java.io.ByteArrayOutputStream; 6 | import java.io.File; 7 | import java.io.IOException; 8 | import java.io.InputStream; 9 | import java.io.OutputStream; 10 | import java.text.MessageFormat; 11 | import java.util.Enumeration; 12 | import java.util.LinkedHashSet; 13 | import java.util.NoSuchElementException; 14 | import java.util.Set; 15 | import java.util.zip.ZipEntry; 16 | import java.util.zip.ZipInputStream; 17 | import javax.swing.JComponent; 18 | import javax.swing.event.ChangeListener; 19 | import org.netbeans.api.project.ProjectManager; 20 | import org.netbeans.api.templates.TemplateRegistration; 21 | import org.netbeans.spi.project.ui.support.ProjectChooser; 22 | import org.netbeans.spi.project.ui.templates.support.Templates; 23 | import org.openide.WizardDescriptor; 24 | import org.openide.filesystems.FileObject; 25 | import org.openide.filesystems.FileUtil; 26 | import org.openide.util.Exceptions; 27 | import org.openide.util.NbBundle; 28 | import org.openide.util.NbBundle.Messages; 29 | import org.openide.xml.XMLUtil; 30 | import org.w3c.dom.Document; 31 | import org.w3c.dom.Element; 32 | import org.w3c.dom.NodeList; 33 | import org.xml.sax.InputSource; 34 | 35 | // TODO define position attribute 36 | @TemplateRegistration(folder = "Project/Samples/HTML5", displayName = "#Greeter_displayName", description = "GreeterDescription.html", iconBase = "org/netbeans/ts/samples/projects/greeter/Greeter.png", content = "GreeterProject.zip") 37 | @Messages("Greeter_displayName=TypeScript Greeter") 38 | public class GreeterWizardIterator implements WizardDescriptor./*Progress*/InstantiatingIterator { 39 | 40 | private int index; 41 | private WizardDescriptor.Panel[] panels; 42 | private WizardDescriptor wiz; 43 | 44 | public GreeterWizardIterator() { 45 | } 46 | 47 | public static GreeterWizardIterator createIterator() { 48 | return new GreeterWizardIterator(); 49 | } 50 | 51 | private WizardDescriptor.Panel[] createPanels() { 52 | return new WizardDescriptor.Panel[]{ 53 | new GreeterWizardPanel(),}; 54 | } 55 | 56 | private String[] createSteps() { 57 | return new String[]{ 58 | NbBundle.getMessage(GreeterWizardIterator.class, "LBL_CreateProjectStep") 59 | }; 60 | } 61 | 62 | public Set/**/ instantiate(/*ProgressHandle handle*/) throws IOException { 63 | Set resultSet = new LinkedHashSet(); 64 | File dirF = FileUtil.normalizeFile((File) wiz.getProperty("projdir")); 65 | dirF.mkdirs(); 66 | 67 | FileObject template = Templates.getTemplate(wiz); 68 | FileObject dir = FileUtil.toFileObject(dirF); 69 | unZipFile(template.getInputStream(), dir); 70 | 71 | // Always open top dir as a project: 72 | resultSet.add(dir); 73 | // Look for nested projects to open as well: 74 | Enumeration e = dir.getFolders(true); 75 | while (e.hasMoreElements()) { 76 | FileObject subfolder = e.nextElement(); 77 | if (ProjectManager.getDefault().isProject(subfolder)) { 78 | resultSet.add(subfolder); 79 | } 80 | } 81 | 82 | File parent = dirF.getParentFile(); 83 | if (parent != null && parent.exists()) { 84 | ProjectChooser.setProjectsFolder(parent); 85 | } 86 | 87 | return resultSet; 88 | } 89 | 90 | public void initialize(WizardDescriptor wiz) { 91 | this.wiz = wiz; 92 | index = 0; 93 | panels = createPanels(); 94 | // Make sure list of steps is accurate. 95 | String[] steps = createSteps(); 96 | for (int i = 0; i < panels.length; i++) { 97 | Component c = panels[i].getComponent(); 98 | if (steps[i] == null) { 99 | // Default step name to component name of panel. 100 | // Mainly useful for getting the name of the target 101 | // chooser to appear in the list of steps. 102 | steps[i] = c.getName(); 103 | } 104 | if (c instanceof JComponent) { // assume Swing components 105 | JComponent jc = (JComponent) c; 106 | // Step #. 107 | // TODO if using org.openide.dialogs >= 7.8, can use WizardDescriptor.PROP_*: 108 | jc.putClientProperty("WizardPanel_contentSelectedIndex", new Integer(i)); 109 | // Step name (actually the whole list for reference). 110 | jc.putClientProperty("WizardPanel_contentData", steps); 111 | } 112 | } 113 | } 114 | 115 | public void uninitialize(WizardDescriptor wiz) { 116 | this.wiz.putProperty("projdir", null); 117 | this.wiz.putProperty("name", null); 118 | this.wiz = null; 119 | panels = null; 120 | } 121 | 122 | public String name() { 123 | return MessageFormat.format("{0} of {1}", 124 | new Object[]{new Integer(index + 1), new Integer(panels.length)}); 125 | } 126 | 127 | public boolean hasNext() { 128 | return index < panels.length - 1; 129 | } 130 | 131 | public boolean hasPrevious() { 132 | return index > 0; 133 | } 134 | 135 | public void nextPanel() { 136 | if (!hasNext()) { 137 | throw new NoSuchElementException(); 138 | } 139 | index++; 140 | } 141 | 142 | public void previousPanel() { 143 | if (!hasPrevious()) { 144 | throw new NoSuchElementException(); 145 | } 146 | index--; 147 | } 148 | 149 | public WizardDescriptor.Panel current() { 150 | return panels[index]; 151 | } 152 | 153 | // If nothing unusual changes in the middle of the wizard, simply: 154 | public final void addChangeListener(ChangeListener l) { 155 | } 156 | 157 | public final void removeChangeListener(ChangeListener l) { 158 | } 159 | 160 | private static void unZipFile(InputStream source, FileObject projectRoot) throws IOException { 161 | try { 162 | ZipInputStream str = new ZipInputStream(source); 163 | ZipEntry entry; 164 | while ((entry = str.getNextEntry()) != null) { 165 | if (entry.isDirectory()) { 166 | FileUtil.createFolder(projectRoot, entry.getName()); 167 | } else { 168 | FileObject fo = FileUtil.createData(projectRoot, entry.getName()); 169 | if ("nbproject/project.xml".equals(entry.getName())) { 170 | // Special handling for setting name of Ant-based projects; customize as needed: 171 | filterProjectXML(fo, str, projectRoot.getName()); 172 | } else { 173 | writeFile(str, fo); 174 | } 175 | } 176 | } 177 | } finally { 178 | source.close(); 179 | } 180 | } 181 | 182 | private static void writeFile(ZipInputStream str, FileObject fo) throws IOException { 183 | OutputStream out = fo.getOutputStream(); 184 | try { 185 | FileUtil.copy(str, out); 186 | } finally { 187 | out.close(); 188 | } 189 | } 190 | 191 | private static void filterProjectXML(FileObject fo, ZipInputStream str, String name) throws IOException { 192 | try { 193 | ByteArrayOutputStream baos = new ByteArrayOutputStream(); 194 | FileUtil.copy(str, baos); 195 | Document doc = XMLUtil.parse(new InputSource(new ByteArrayInputStream(baos.toByteArray())), false, false, null, null); 196 | NodeList nl = doc.getDocumentElement().getElementsByTagName("name"); 197 | if (nl != null) { 198 | for (int i = 0; i < nl.getLength(); i++) { 199 | Element el = (Element) nl.item(i); 200 | if (el.getParentNode() != null && "data".equals(el.getParentNode().getNodeName())) { 201 | NodeList nl2 = el.getChildNodes(); 202 | if (nl2.getLength() > 0) { 203 | nl2.item(0).setNodeValue(name); 204 | } 205 | break; 206 | } 207 | } 208 | } 209 | OutputStream out = fo.getOutputStream(); 210 | try { 211 | XMLUtil.write(doc, out, "UTF-8"); 212 | } finally { 213 | out.close(); 214 | } 215 | } catch (Exception ex) { 216 | Exceptions.printStackTrace(ex); 217 | writeFile(str, fo); 218 | } 219 | 220 | } 221 | 222 | } 223 | -------------------------------------------------------------------------------- /src/main/resources/org/netbeans/ts/codetemplates.xml: -------------------------------------------------------------------------------- 1 | 2 | 43 | 44 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 56 | 57 | 58 | 59 | 60 | 63 | 64 | 65 | 66 | 67 | 71 | 72 | 73 | 74 | 75 | 79 | 80 | 81 | 82 | 83 | 84 | ${selection}${cursor} 85 | // 86 | ]]> 87 | 88 | 89 | 90 | 91 | 94 | 95 | 96 | 97 | 98 | 101 | 102 | 103 | 104 | 105 | 108 | 109 | 110 | 111 | 112 | 116 | 117 | 118 | 119 | 120 | 126 | 127 | 128 | 129 | 130 | 137 | 138 | 139 | 140 | 141 | 147 | 148 | 149 | 150 | 151 | 154 | 155 | 156 | 157 | 158 | 162 | 163 | 164 | 165 | 166 | 170 | 171 | 172 | 173 | 174 | 178 | 179 | 180 | 181 | 182 | 185 | 186 | 187 | 188 | 189 | 193 | 194 | 195 | 196 | 197 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 242 | 243 | 244 | 245 | 246 | 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 | 282 | 283 | 284 | 285 | 286 | 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 | 331 | 332 | 333 | 336 | 337 | 338 | { 339 | ${cursor} 340 | }]]> 341 | 342 | 343 | -------------------------------------------------------------------------------- /src/main/java/org/netbeans/ts/samples/projects/greeter/GreeterPanelVisual.java: -------------------------------------------------------------------------------- 1 | package org.netbeans.ts.samples.projects.greeter; 2 | 3 | import java.io.File; 4 | import javax.swing.JFileChooser; 5 | import javax.swing.JPanel; 6 | import javax.swing.event.DocumentEvent; 7 | import javax.swing.event.DocumentListener; 8 | import javax.swing.text.Document; 9 | import org.netbeans.spi.project.ui.support.ProjectChooser; 10 | import org.openide.WizardDescriptor; 11 | import org.openide.WizardValidationException; 12 | import org.openide.filesystems.FileUtil; 13 | 14 | public class GreeterPanelVisual extends JPanel implements DocumentListener { 15 | 16 | public static final String PROP_PROJECT_NAME = "projectName"; 17 | 18 | private GreeterWizardPanel panel; 19 | 20 | public GreeterPanelVisual(GreeterWizardPanel panel) { 21 | initComponents(); 22 | this.panel = panel; 23 | // Register listener on the textFields to make the automatic updates 24 | projectNameTextField.getDocument().addDocumentListener(this); 25 | projectLocationTextField.getDocument().addDocumentListener(this); 26 | } 27 | 28 | public String getProjectName() { 29 | return this.projectNameTextField.getText(); 30 | } 31 | 32 | /** 33 | * This method is called from within the constructor to initialize the form. 34 | * WARNING: Do NOT modify this code. The content of this method is always 35 | * regenerated by the Form Editor. 36 | */ 37 | // //GEN-BEGIN:initComponents 38 | private void initComponents() { 39 | 40 | projectNameLabel = new javax.swing.JLabel(); 41 | projectNameTextField = new javax.swing.JTextField(); 42 | projectLocationLabel = new javax.swing.JLabel(); 43 | projectLocationTextField = new javax.swing.JTextField(); 44 | browseButton = new javax.swing.JButton(); 45 | createdFolderLabel = new javax.swing.JLabel(); 46 | createdFolderTextField = new javax.swing.JTextField(); 47 | 48 | projectNameLabel.setLabelFor(projectNameTextField); 49 | org.openide.awt.Mnemonics.setLocalizedText(projectNameLabel, org.openide.util.NbBundle.getMessage(GreeterPanelVisual.class, "GreeterPanelVisual.projectNameLabel.text")); // NOI18N 50 | 51 | projectLocationLabel.setLabelFor(projectLocationTextField); 52 | org.openide.awt.Mnemonics.setLocalizedText(projectLocationLabel, org.openide.util.NbBundle.getMessage(GreeterPanelVisual.class, "GreeterPanelVisual.projectLocationLabel.text")); // NOI18N 53 | 54 | org.openide.awt.Mnemonics.setLocalizedText(browseButton, org.openide.util.NbBundle.getMessage(GreeterPanelVisual.class, "GreeterPanelVisual.browseButton.text")); // NOI18N 55 | browseButton.setActionCommand(org.openide.util.NbBundle.getMessage(GreeterPanelVisual.class, "GreeterPanelVisual.browseButton.actionCommand")); // NOI18N 56 | browseButton.addActionListener(new java.awt.event.ActionListener() { 57 | public void actionPerformed(java.awt.event.ActionEvent evt) { 58 | browseButtonActionPerformed(evt); 59 | } 60 | }); 61 | 62 | createdFolderLabel.setLabelFor(createdFolderTextField); 63 | org.openide.awt.Mnemonics.setLocalizedText(createdFolderLabel, org.openide.util.NbBundle.getMessage(GreeterPanelVisual.class, "GreeterPanelVisual.createdFolderLabel.text")); // NOI18N 64 | 65 | createdFolderTextField.setEditable(false); 66 | 67 | javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); 68 | this.setLayout(layout); 69 | layout.setHorizontalGroup( 70 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 71 | .addGroup(layout.createSequentialGroup() 72 | .addContainerGap() 73 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 74 | .addComponent(projectNameLabel) 75 | .addComponent(projectLocationLabel) 76 | .addComponent(createdFolderLabel)) 77 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) 78 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 79 | .addComponent(projectNameTextField, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 191, Short.MAX_VALUE) 80 | .addComponent(projectLocationTextField, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 191, Short.MAX_VALUE) 81 | .addComponent(createdFolderTextField, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 191, Short.MAX_VALUE)) 82 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) 83 | .addComponent(browseButton) 84 | .addContainerGap()) 85 | ); 86 | layout.setVerticalGroup( 87 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 88 | .addGroup(layout.createSequentialGroup() 89 | .addContainerGap() 90 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) 91 | .addComponent(projectNameLabel) 92 | .addComponent(projectNameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) 93 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) 94 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) 95 | .addComponent(projectLocationLabel) 96 | .addComponent(projectLocationTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) 97 | .addComponent(browseButton)) 98 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) 99 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) 100 | .addComponent(createdFolderLabel) 101 | .addComponent(createdFolderTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) 102 | .addContainerGap(213, Short.MAX_VALUE)) 103 | ); 104 | }// //GEN-END:initComponents 105 | 106 | private void browseButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_browseButtonActionPerformed 107 | String command = evt.getActionCommand(); 108 | if ("BROWSE".equals(command)) { 109 | JFileChooser chooser = new JFileChooser(); 110 | FileUtil.preventFileChooserSymlinkTraversal(chooser, null); 111 | chooser.setDialogTitle("Select Project Location"); 112 | chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); 113 | String path = this.projectLocationTextField.getText(); 114 | if (path.length() > 0) { 115 | File f = new File(path); 116 | if (f.exists()) { 117 | chooser.setSelectedFile(f); 118 | } 119 | } 120 | if (JFileChooser.APPROVE_OPTION == chooser.showOpenDialog(this)) { 121 | File projectDir = chooser.getSelectedFile(); 122 | projectLocationTextField.setText(FileUtil.normalizeFile(projectDir).getAbsolutePath()); 123 | } 124 | panel.fireChangeEvent(); 125 | } 126 | 127 | }//GEN-LAST:event_browseButtonActionPerformed 128 | 129 | // Variables declaration - do not modify//GEN-BEGIN:variables 130 | private javax.swing.JButton browseButton; 131 | private javax.swing.JLabel createdFolderLabel; 132 | private javax.swing.JTextField createdFolderTextField; 133 | private javax.swing.JLabel projectLocationLabel; 134 | private javax.swing.JTextField projectLocationTextField; 135 | private javax.swing.JLabel projectNameLabel; 136 | private javax.swing.JTextField projectNameTextField; 137 | // End of variables declaration//GEN-END:variables 138 | 139 | @Override 140 | public void addNotify() { 141 | super.addNotify(); 142 | //same problem as in 31086, initial focus on Cancel button 143 | projectNameTextField.requestFocus(); 144 | } 145 | 146 | boolean valid(WizardDescriptor wizardDescriptor) { 147 | 148 | if (projectNameTextField.getText().length() == 0) { 149 | // TODO if using org.openide.dialogs >= 7.8, can use WizardDescriptor.PROP_ERROR_MESSAGE: 150 | wizardDescriptor.putProperty("WizardPanel_errorMessage", 151 | "Project Name is not a valid folder name."); 152 | return false; // Display name not specified 153 | } 154 | File f = FileUtil.normalizeFile(new File(projectLocationTextField.getText()).getAbsoluteFile()); 155 | if (!f.isDirectory()) { 156 | String message = "Project Folder is not a valid path."; 157 | wizardDescriptor.putProperty("WizardPanel_errorMessage", message); 158 | return false; 159 | } 160 | final File destFolder = FileUtil.normalizeFile(new File(createdFolderTextField.getText()).getAbsoluteFile()); 161 | 162 | File projLoc = destFolder; 163 | while (projLoc != null && !projLoc.exists()) { 164 | projLoc = projLoc.getParentFile(); 165 | } 166 | if (projLoc == null || !projLoc.canWrite()) { 167 | wizardDescriptor.putProperty("WizardPanel_errorMessage", 168 | "Project Folder cannot be created."); 169 | return false; 170 | } 171 | 172 | if (FileUtil.toFileObject(projLoc) == null) { 173 | String message = "Project Folder is not a valid path."; 174 | wizardDescriptor.putProperty("WizardPanel_errorMessage", message); 175 | return false; 176 | } 177 | 178 | File[] kids = destFolder.listFiles(); 179 | if (destFolder.exists() && kids != null && kids.length > 0) { 180 | // Folder exists and is not empty 181 | wizardDescriptor.putProperty("WizardPanel_errorMessage", 182 | "Project Folder already exists and is not empty."); 183 | return false; 184 | } 185 | wizardDescriptor.putProperty("WizardPanel_errorMessage", ""); 186 | return true; 187 | } 188 | 189 | void store(WizardDescriptor d) { 190 | String name = projectNameTextField.getText().trim(); 191 | String folder = createdFolderTextField.getText().trim(); 192 | 193 | d.putProperty("projdir", new File(folder)); 194 | d.putProperty("name", name); 195 | } 196 | 197 | void read(WizardDescriptor settings) { 198 | File projectLocation = (File) settings.getProperty("projdir"); 199 | if (projectLocation == null || projectLocation.getParentFile() == null || !projectLocation.getParentFile().isDirectory()) { 200 | projectLocation = ProjectChooser.getProjectsFolder(); 201 | } else { 202 | projectLocation = projectLocation.getParentFile(); 203 | } 204 | this.projectLocationTextField.setText(projectLocation.getAbsolutePath()); 205 | 206 | String projectName = (String) settings.getProperty("name"); 207 | if (projectName == null) { 208 | projectName = "Greeter"; 209 | } 210 | this.projectNameTextField.setText(projectName); 211 | this.projectNameTextField.selectAll(); 212 | } 213 | 214 | void validate(WizardDescriptor d) throws WizardValidationException { 215 | // nothing to validate 216 | } 217 | 218 | // Implementation of DocumentListener -------------------------------------- 219 | public void changedUpdate(DocumentEvent e) { 220 | updateTexts(e); 221 | if (this.projectNameTextField.getDocument() == e.getDocument()) { 222 | firePropertyChange(PROP_PROJECT_NAME, null, this.projectNameTextField.getText()); 223 | } 224 | } 225 | 226 | public void insertUpdate(DocumentEvent e) { 227 | updateTexts(e); 228 | if (this.projectNameTextField.getDocument() == e.getDocument()) { 229 | firePropertyChange(PROP_PROJECT_NAME, null, this.projectNameTextField.getText()); 230 | } 231 | } 232 | 233 | public void removeUpdate(DocumentEvent e) { 234 | updateTexts(e); 235 | if (this.projectNameTextField.getDocument() == e.getDocument()) { 236 | firePropertyChange(PROP_PROJECT_NAME, null, this.projectNameTextField.getText()); 237 | } 238 | } 239 | 240 | /** 241 | * Handles changes in the Project name and project directory, 242 | */ 243 | private void updateTexts(DocumentEvent e) { 244 | 245 | Document doc = e.getDocument(); 246 | 247 | if (doc == projectNameTextField.getDocument() || doc == projectLocationTextField.getDocument()) { 248 | // Change in the project name 249 | 250 | String projectName = projectNameTextField.getText(); 251 | String projectFolder = projectLocationTextField.getText(); 252 | 253 | //if (projectFolder.trim().length() == 0 || projectFolder.equals(oldName)) { 254 | createdFolderTextField.setText(projectFolder + File.separatorChar + projectName); 255 | //} 256 | 257 | } 258 | panel.fireChangeEvent(); // Notify that the panel changed 259 | } 260 | 261 | } 262 | -------------------------------------------------------------------------------- /src/main/java/org/netbeans/ts/options/TypeScriptOptionsPanel.java: -------------------------------------------------------------------------------- 1 | package org.netbeans.ts.options; 2 | 3 | import java.awt.Component; 4 | import java.awt.Cursor; 5 | import java.awt.event.ActionEvent; 6 | import java.awt.event.ActionListener; 7 | import java.awt.event.ItemEvent; 8 | import java.awt.event.ItemListener; 9 | import java.awt.event.MouseAdapter; 10 | import java.awt.event.MouseEvent; 11 | import java.io.File; 12 | import java.net.MalformedURLException; 13 | import java.net.URL; 14 | import java.util.List; 15 | import java.util.logging.Level; 16 | import java.util.logging.Logger; 17 | import javax.swing.GroupLayout; 18 | import javax.swing.JButton; 19 | import javax.swing.JCheckBox; 20 | import javax.swing.JLabel; 21 | import javax.swing.JPanel; 22 | import javax.swing.JTextField; 23 | import javax.swing.LayoutStyle; 24 | import javax.swing.SwingConstants; 25 | import javax.swing.event.ChangeListener; 26 | import javax.swing.event.DocumentEvent; 27 | import javax.swing.event.DocumentListener; 28 | //import org.netbeans.modules.css.prep.sass.TypeScriptExecutable; 29 | //import org.netbeans.modules.css.prep.util.FileUtils; 30 | import org.openide.awt.HtmlBrowser; 31 | import org.openide.awt.Mnemonics; 32 | import org.openide.awt.StatusDisplayer; 33 | import org.openide.filesystems.FileChooserBuilder; 34 | import org.openide.util.ChangeSupport; 35 | import org.openide.util.NbBundle; 36 | import org.openide.util.NbPreferences; 37 | 38 | public final class TypeScriptOptionsPanel extends JPanel { 39 | 40 | private static final long serialVersionUID = 268356546654654L; 41 | 42 | private static final Logger LOGGER = Logger.getLogger(TypeScriptOptionsPanel.class.getName()); 43 | 44 | private final ChangeSupport changeSupport = new ChangeSupport(this); 45 | 46 | 47 | public TypeScriptOptionsPanel() { 48 | initComponents(); 49 | init(); 50 | } 51 | 52 | @NbBundle.Messages({ 53 | "# {0} - long script name", 54 | "# {1} - short script name", 55 | "TypeScriptOptionsPanel.path.hint=Full path of TypeScript executable (typically {0} or {1}).", 56 | }) 57 | private void init() { 58 | tscPathHintLabel.setText(Bundle.TypeScriptOptionsPanel_path_hint("tsc.cmd", "tsc")); 59 | 60 | // listeners 61 | tscPathTextField.getDocument().addDocumentListener(new DefaultDocumentListener()); 62 | DefaultItemListener defaultItemListener = new DefaultItemListener(); 63 | tscOutputOnErrorCheckBox.addItemListener(defaultItemListener); 64 | tscDebugCheckBox.addItemListener(defaultItemListener); 65 | } 66 | 67 | void load() { 68 | // TODO read settings and initialize GUI 69 | // Example: 70 | // someCheckBox.setSelected(Preferences.userNodeForPackage(BlaPanel.class).getBoolean("someFlag", false)); 71 | // or for org.openide.util with API spec. version >= 7.4: 72 | tscPathTextField.setText(NbPreferences.forModule(TypeScriptOptionsPanel.class).get("tscPath", "")); 73 | // or: 74 | // someTextField.setText(SomeSystemOption.getDefault().getSomeStringProperty()); 75 | } 76 | 77 | void store() { 78 | // TODO store modified settings 79 | // Example: 80 | // Preferences.userNodeForPackage(BlaPanel.class).putBoolean("someFlag", someCheckBox.isSelected()); 81 | // or for org.openide.util with API spec. version >= 7.4: 82 | NbPreferences.forModule(TypeScriptOptionsPanel.class).put("tscPath", tscPathTextField.getText()); 83 | // or: 84 | // SomeSystemOption.getDefault().setSomeStringProperty(someTextField.getText()); 85 | } 86 | 87 | public String getTypeScriptPath() { 88 | return tscPathTextField.getText(); 89 | } 90 | 91 | public void setTypeScriptPath(String path) { 92 | tscPathTextField.setText(path); 93 | } 94 | 95 | public boolean getTypeScriptOutputOnError() { 96 | return tscOutputOnErrorCheckBox.isSelected(); 97 | } 98 | 99 | public void setTypeScriptOutputOnError(boolean outputOnError) { 100 | tscOutputOnErrorCheckBox.setSelected(outputOnError); 101 | } 102 | 103 | public boolean getTypeScriptDebug() { 104 | return tscDebugCheckBox.isSelected(); 105 | } 106 | 107 | public void setTypeScriptDebug(boolean debug) { 108 | tscDebugCheckBox.setSelected(debug); 109 | } 110 | 111 | public void addChangeListener(ChangeListener listener) { 112 | changeSupport.addChangeListener(listener); 113 | } 114 | 115 | public void removeChangeListener(ChangeListener listener) { 116 | changeSupport.removeChangeListener(listener); 117 | } 118 | 119 | void fireChange() { 120 | changeSupport.fireChange(); 121 | } 122 | 123 | /** 124 | * This method is called from within the constructor to initialize the form. WARNING: Do NOT modify this code. The content of this method is always regenerated by the Form Editor. 125 | */ 126 | @SuppressWarnings("unchecked") 127 | // //GEN-BEGIN:initComponents 128 | private void initComponents() { 129 | 130 | tscPathLabel = new JLabel(); 131 | tscPathTextField = new JTextField(); 132 | tscPathBrowseButton = new JButton(); 133 | tscPathSearchButton = new JButton(); 134 | tscPathHintLabel = new JLabel(); 135 | installTscLabel = new JLabel(); 136 | tscOutputOnErrorCheckBox = new JCheckBox(); 137 | tscDebugCheckBox = new JCheckBox(); 138 | 139 | tscPathLabel.setLabelFor(tscPathTextField); 140 | Mnemonics.setLocalizedText(tscPathLabel, NbBundle.getMessage(TypeScriptOptionsPanel.class, "TypeScriptOptionsPanel.TypeScriptPathLabel.text")); // NOI18N 141 | 142 | Mnemonics.setLocalizedText(tscPathBrowseButton, NbBundle.getMessage(TypeScriptOptionsPanel.class, "TypeScriptOptionsPanel.tscPathBrowseButton.text")); // NOI18N 143 | tscPathBrowseButton.addActionListener(new ActionListener() { 144 | public void actionPerformed(ActionEvent evt) { 145 | tscPathBrowseButtonActionPerformed(evt); 146 | } 147 | }); 148 | 149 | Mnemonics.setLocalizedText(tscPathSearchButton, NbBundle.getMessage(TypeScriptOptionsPanel.class, "TypeScriptOptionsPanel.tscPathSearchButton.text")); // NOI18N 150 | tscPathSearchButton.addActionListener(new ActionListener() { 151 | public void actionPerformed(ActionEvent evt) { 152 | tscPathSearchButtonActionPerformed(evt); 153 | } 154 | }); 155 | 156 | Mnemonics.setLocalizedText(tscPathHintLabel, "HINT"); // NOI18N 157 | 158 | Mnemonics.setLocalizedText(installTscLabel, NbBundle.getMessage(TypeScriptOptionsPanel.class, "TypeScriptOptionsPanel.installTypeScriptLabel.text")); // NOI18N 159 | installTscLabel.addMouseListener(new MouseAdapter() { 160 | public void mouseEntered(MouseEvent evt) { 161 | installTscLabelMouseEntered(evt); 162 | } 163 | public void mousePressed(MouseEvent evt) { 164 | installTscLabelMousePressed(evt); 165 | } 166 | }); 167 | 168 | Mnemonics.setLocalizedText(tscOutputOnErrorCheckBox, NbBundle.getMessage(TypeScriptOptionsPanel.class, "TypeScriptOptionsPanel.tscOutputOnErrorCheckBox.text")); // NOI18N 169 | 170 | Mnemonics.setLocalizedText(tscDebugCheckBox, NbBundle.getMessage(TypeScriptOptionsPanel.class, "TypeScriptOptionsPanel.tscDebugCheckBox.text")); // NOI18N 171 | 172 | GroupLayout layout = new GroupLayout(this); 173 | this.setLayout(layout); 174 | layout.setHorizontalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING) 175 | .addGroup(layout.createSequentialGroup() 176 | .addComponent(tscPathLabel) 177 | .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) 178 | .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING) 179 | .addGroup(layout.createSequentialGroup() 180 | .addComponent(tscPathHintLabel) 181 | .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) 182 | .addComponent(installTscLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) 183 | .addGroup(layout.createSequentialGroup() 184 | .addComponent(tscPathTextField) 185 | .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) 186 | .addComponent(tscPathBrowseButton) 187 | .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) 188 | .addComponent(tscPathSearchButton)))) 189 | .addGroup(layout.createSequentialGroup() 190 | .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING) 191 | .addComponent(tscOutputOnErrorCheckBox) 192 | .addComponent(tscDebugCheckBox)) 193 | .addGap(0, 0, Short.MAX_VALUE)) 194 | ); 195 | 196 | layout.linkSize(SwingConstants.HORIZONTAL, new Component[] {tscPathBrowseButton, tscPathSearchButton}); 197 | 198 | layout.setVerticalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING) 199 | .addGroup(layout.createSequentialGroup() 200 | .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE) 201 | .addComponent(tscPathLabel) 202 | .addComponent(tscPathBrowseButton) 203 | .addComponent(tscPathSearchButton) 204 | .addComponent(tscPathTextField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) 205 | .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) 206 | .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE) 207 | .addComponent(tscPathHintLabel) 208 | .addComponent(installTscLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) 209 | .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) 210 | .addComponent(tscOutputOnErrorCheckBox) 211 | .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) 212 | .addComponent(tscDebugCheckBox) 213 | .addGap(0, 0, Short.MAX_VALUE)) 214 | ); 215 | }// //GEN-END:initComponents 216 | 217 | @NbBundle.Messages("TypeScriptOptionsPanel.browse.title=Select TypeScript") 218 | private void tscPathBrowseButtonActionPerformed(ActionEvent evt) {//GEN-FIRST:event_tscPathBrowseButtonActionPerformed 219 | File file = new FileChooserBuilder(TypeScriptOptionsPanel.class) 220 | .setFilesOnly(true) 221 | .setTitle(Bundle.TypeScriptOptionsPanel_browse_title()) 222 | .showOpenDialog(); 223 | if (file != null) { 224 | tscPathTextField.setText(file.getAbsolutePath()); 225 | } 226 | }//GEN-LAST:event_tscPathBrowseButtonActionPerformed 227 | 228 | @NbBundle.Messages("TypeScriptOptionsPanel.executable.notFound=No TypeScript executable found.") 229 | private void tscPathSearchButtonActionPerformed(ActionEvent evt) {//GEN-FIRST:event_tscPathSearchButtonActionPerformed 230 | List tscPaths = FileUtils.findFileOnUsersPath("tsc.cmd", "tsc"); 231 | if (tscPaths.isEmpty()) { 232 | StatusDisplayer.getDefault().setStatusText(Bundle.TypeScriptOptionsPanel_executable_notFound()); 233 | } else { 234 | tscPathTextField.setText(tscPaths.get(0)); 235 | } 236 | }//GEN-LAST:event_tscPathSearchButtonActionPerformed 237 | 238 | private void installTscLabelMouseEntered(MouseEvent evt) {//GEN-FIRST:event_installTscLabelMouseEntered 239 | evt.getComponent().setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); 240 | }//GEN-LAST:event_installTscLabelMouseEntered 241 | 242 | private void installTscLabelMousePressed(MouseEvent evt) {//GEN-FIRST:event_installTscLabelMousePressed 243 | try { 244 | URL url = new URL("https://www.npmjs.com/package/typescript"); // NOI18N 245 | HtmlBrowser.URLDisplayer.getDefault().showURL(url); 246 | } catch (MalformedURLException ex) { 247 | LOGGER.log(Level.SEVERE, null, ex); 248 | } 249 | }//GEN-LAST:event_installTscLabelMousePressed 250 | 251 | // Variables declaration - do not modify//GEN-BEGIN:variables 252 | private JLabel installTscLabel; 253 | private JCheckBox tscDebugCheckBox; 254 | private JCheckBox tscOutputOnErrorCheckBox; 255 | private JButton tscPathBrowseButton; 256 | private JLabel tscPathHintLabel; 257 | private JLabel tscPathLabel; 258 | private JButton tscPathSearchButton; 259 | private JTextField tscPathTextField; 260 | // End of variables declaration//GEN-END:variables 261 | 262 | //~ Inner classes 263 | 264 | private final class DefaultDocumentListener implements DocumentListener { 265 | 266 | @Override 267 | public void insertUpdate(DocumentEvent e) { 268 | processUpdate(); 269 | } 270 | 271 | @Override 272 | public void removeUpdate(DocumentEvent e) { 273 | processUpdate(); 274 | } 275 | 276 | @Override 277 | public void changedUpdate(DocumentEvent e) { 278 | processUpdate(); 279 | } 280 | 281 | private void processUpdate() { 282 | fireChange(); 283 | } 284 | 285 | } 286 | 287 | private final class DefaultItemListener implements ItemListener { 288 | 289 | @Override 290 | public void itemStateChanged(ItemEvent e) { 291 | fireChange(); 292 | } 293 | 294 | } 295 | 296 | } 297 | -------------------------------------------------------------------------------- /ECMAScript.g4: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2014 by Bart Kiers 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | * OTHER DEALINGS IN THE SOFTWARE. 26 | */ 27 | 28 | /** 29 | * from https://raw.githubusercontent.com/antlr/grammars-v4/master/ecmascript/ECMAScript.g4 30 | */ 31 | grammar ECMAScript; 32 | 33 | @parser::members { 34 | 35 | /** 36 | * Returns {@code true} iff on the current index of the parser's 37 | * token stream a token of the given {@code type} exists on the 38 | * {@code HIDDEN} channel. 39 | * 40 | * @param type 41 | * the type of the token on the {@code HIDDEN} channel 42 | * to check. 43 | * 44 | * @return {@code true} iff on the current index of the parser's 45 | * token stream a token of the given {@code type} exists on the 46 | * {@code HIDDEN} channel. 47 | */ 48 | private boolean here(final int type) { 49 | 50 | // Get the token ahead of the current index. 51 | int possibleIndexEosToken = this.getCurrentToken().getTokenIndex() - 1; 52 | Token ahead = _input.get(possibleIndexEosToken); 53 | 54 | // Check if the token resides on the HIDDEN channel and if it's of the 55 | // provided type. 56 | return (ahead.getChannel() == Lexer.HIDDEN) && (ahead.getType() == type); 57 | } 58 | 59 | /** 60 | * Returns {@code true} iff on the current index of the parser's 61 | * token stream a token exists on the {@code HIDDEN} channel which 62 | * either is a line terminator, or is a multi line comment that 63 | * contains a line terminator. 64 | * 65 | * @return {@code true} iff on the current index of the parser's 66 | * token stream a token exists on the {@code HIDDEN} channel which 67 | * either is a line terminator, or is a multi line comment that 68 | * contains a line terminator. 69 | */ 70 | private boolean lineTerminatorAhead() { 71 | 72 | // Get the token ahead of the current index. 73 | int possibleIndexEosToken = this.getCurrentToken().getTokenIndex() - 1; 74 | Token ahead = _input.get(possibleIndexEosToken); 75 | 76 | if (ahead.getChannel() != Lexer.HIDDEN) { 77 | // We're only interested in tokens on the HIDDEN channel. 78 | return false; 79 | } 80 | 81 | if (ahead.getType() == LineTerminator) { 82 | // There is definitely a line terminator ahead. 83 | return true; 84 | } 85 | 86 | if (ahead.getType() == WhiteSpaces) { 87 | // Get the token ahead of the current whitespaces. 88 | possibleIndexEosToken = this.getCurrentToken().getTokenIndex() - 2; 89 | ahead = _input.get(possibleIndexEosToken); 90 | } 91 | 92 | // Get the token's text and type. 93 | String text = ahead.getText(); 94 | int type = ahead.getType(); 95 | 96 | // Check if the token is, or contains a line terminator. 97 | return (type == MultiLineComment && (text.contains("\r") || text.contains("\n"))) || 98 | (type == LineTerminator); 99 | } 100 | } 101 | 102 | @lexer::members { 103 | 104 | // A flag indicating if the lexer should operate in strict mode. 105 | // When set to true, FutureReservedWords are tokenized, when false, 106 | // an octal literal can be tokenized. 107 | private boolean strictMode = true; 108 | 109 | // The most recently produced token. 110 | private Token lastToken = null; 111 | 112 | /** 113 | * Returns {@code true} iff the lexer operates in strict mode. 114 | * 115 | * @return {@code true} iff the lexer operates in strict mode. 116 | */ 117 | public boolean getStrictMode() { 118 | return this.strictMode; 119 | } 120 | 121 | /** 122 | * Sets whether the lexer operates in strict mode or not. 123 | * 124 | * @param strictMode 125 | * the flag indicating the lexer operates in strict mode or not. 126 | */ 127 | public void setStrictMode(boolean strictMode) { 128 | this.strictMode = strictMode; 129 | } 130 | 131 | /** 132 | * Return the next token from the character stream and records this last 133 | * token in case it resides on the default channel. This recorded token 134 | * is used to determine when the lexer could possibly match a regex 135 | * literal. 136 | * 137 | * @return the next token from the character stream. 138 | */ 139 | @Override 140 | public Token nextToken() { 141 | 142 | // Get the next token. 143 | Token next = super.nextToken(); 144 | 145 | if (next.getChannel() == Token.DEFAULT_CHANNEL) { 146 | // Keep track of the last token on the default channel. 147 | this.lastToken = next; 148 | } 149 | 150 | return next; 151 | } 152 | 153 | /** 154 | * Returns {@code true} iff the lexer can match a regex literal. 155 | * 156 | * @return {@code true} iff the lexer can match a regex literal. 157 | */ 158 | private boolean isRegexPossible() { 159 | 160 | if (this.lastToken == null) { 161 | // No token has been produced yet: at the start of the input, 162 | // no division is possible, so a regex literal _is_ possible. 163 | return true; 164 | } 165 | 166 | switch (this.lastToken.getType()) { 167 | case Identifier: 168 | case NullLiteral: 169 | case BooleanLiteral: 170 | case This: 171 | case CloseBracket: 172 | case CloseParen: 173 | case OctalIntegerLiteral: 174 | case DecimalLiteral: 175 | case HexIntegerLiteral: 176 | case StringLiteral: 177 | // After any of the tokens above, no regex literal can follow. 178 | return false; 179 | default: 180 | // In all other cases, a regex literal _is_ possible. 181 | return true; 182 | } 183 | } 184 | } 185 | 186 | /// Program : 187 | /// SourceElements? 188 | program 189 | : sourceElements? EOF 190 | ; 191 | 192 | /// SourceElements : 193 | /// SourceElement 194 | /// SourceElements SourceElement 195 | sourceElements 196 | : sourceElement+ 197 | ; 198 | 199 | /// SourceElement : 200 | /// Statement 201 | /// FunctionDeclaration 202 | sourceElement 203 | : statement 204 | | functionDeclaration 205 | ; 206 | 207 | /// Statement : 208 | /// Block 209 | /// VariableStatement 210 | /// EmptyStatement 211 | /// ExpressionStatement 212 | /// IfStatement 213 | /// IterationStatement 214 | /// ContinueStatement 215 | /// BreakStatement 216 | /// ReturnStatement 217 | /// WithStatement 218 | /// LabelledStatement 219 | /// SwitchStatement 220 | /// ThrowStatement 221 | /// TryStatement 222 | /// DebuggerStatement 223 | statement 224 | : block 225 | | variableStatement 226 | | emptyStatement 227 | | expressionStatement 228 | | ifStatement 229 | | iterationStatement 230 | | continueStatement 231 | | breakStatement 232 | | returnStatement 233 | | withStatement 234 | | labelledStatement 235 | | switchStatement 236 | | throwStatement 237 | | tryStatement 238 | | debuggerStatement 239 | ; 240 | 241 | /// Block : 242 | /// { StatementList? } 243 | block 244 | : '{' statementList? '}' 245 | ; 246 | 247 | /// StatementList : 248 | /// Statement 249 | /// StatementList Statement 250 | statementList 251 | : statement+ 252 | ; 253 | 254 | /// VariableStatement : 255 | /// var VariableDeclarationList ; 256 | variableStatement 257 | : Var variableDeclarationList eos 258 | ; 259 | 260 | /// VariableDeclarationList : 261 | /// VariableDeclaration 262 | /// VariableDeclarationList , VariableDeclaration 263 | variableDeclarationList 264 | : variableDeclaration ( ',' variableDeclaration )* 265 | ; 266 | 267 | /// VariableDeclaration : 268 | /// Identifier Initialiser? 269 | variableDeclaration 270 | : Identifier initialiser? 271 | ; 272 | 273 | /// Initialiser : 274 | /// = AssignmentExpression 275 | initialiser 276 | : '=' singleExpression 277 | ; 278 | 279 | /// EmptyStatement : 280 | /// ; 281 | emptyStatement 282 | : SemiColon 283 | ; 284 | 285 | /// ExpressionStatement : 286 | /// [lookahead ∉ {{, function}] Expression ; 287 | expressionStatement 288 | : {(_input.LA(1) != OpenBrace) && (_input.LA(1) != Function)}? expressionSequence eos 289 | ; 290 | 291 | /// IfStatement : 292 | /// if ( Expression ) Statement else Statement 293 | /// if ( Expression ) Statement 294 | ifStatement 295 | : If '(' expressionSequence ')' statement ( Else statement )? 296 | ; 297 | 298 | /// IterationStatement : 299 | /// do Statement while ( Expression ); 300 | /// while ( Expression ) Statement 301 | /// for ( Expression? ; Expression? ; Expression? ) Statement 302 | /// for ( var VariableDeclarationList ; Expression? ; Expression? ) Statement 303 | /// for ( LeftHandSideExpression in Expression ) Statement 304 | /// for ( var VariableDeclaration in Expression ) Statement 305 | iterationStatement 306 | : Do statement While '(' expressionSequence ')' eos # DoStatement 307 | | While '(' expressionSequence ')' statement # WhileStatement 308 | | For '(' expressionSequence? ';' expressionSequence? ';' expressionSequence? ')' statement # ForStatement 309 | | For '(' Var variableDeclarationList ';' expressionSequence? ';' expressionSequence? ')' statement # ForVarStatement 310 | | For '(' singleExpression In expressionSequence ')' statement # ForInStatement 311 | | For '(' Var variableDeclaration In expressionSequence ')' statement # ForVarInStatement 312 | ; 313 | 314 | /// ContinueStatement : 315 | /// continue ; 316 | /// continue [no LineTerminator here] Identifier ; 317 | continueStatement 318 | : Continue Identifier? eos 319 | ; 320 | 321 | /// BreakStatement : 322 | /// break ; 323 | /// break [no LineTerminator here] Identifier ; 324 | breakStatement 325 | : Break Identifier? eos 326 | ; 327 | 328 | /// ReturnStatement : 329 | /// return ; 330 | /// return [no LineTerminator here] Expression ; 331 | returnStatement 332 | : Return expressionSequence? eos 333 | ; 334 | 335 | /// WithStatement : 336 | /// with ( Expression ) Statement 337 | withStatement 338 | : With '(' expressionSequence ')' statement 339 | ; 340 | 341 | /// SwitchStatement : 342 | /// switch ( Expression ) CaseBlock 343 | switchStatement 344 | : Switch '(' expressionSequence ')' caseBlock 345 | ; 346 | 347 | /// CaseBlock : 348 | /// { CaseClauses? } 349 | /// { CaseClauses? DefaultClause CaseClauses? } 350 | caseBlock 351 | : '{' caseClauses? ( defaultClause caseClauses? )? '}' 352 | ; 353 | 354 | /// CaseClauses : 355 | /// CaseClause 356 | /// CaseClauses CaseClause 357 | caseClauses 358 | : caseClause+ 359 | ; 360 | 361 | /// CaseClause : 362 | /// case Expression ':' StatementList? 363 | caseClause 364 | : Case expressionSequence ':' statementList? 365 | ; 366 | 367 | /// DefaultClause : 368 | /// default ':' StatementList? 369 | defaultClause 370 | : Default ':' statementList? 371 | ; 372 | 373 | /// LabelledStatement : 374 | /// Identifier ':' Statement 375 | labelledStatement 376 | : Identifier ':' statement 377 | ; 378 | 379 | /// ThrowStatement : 380 | /// throw [no LineTerminator here] Expression ; 381 | throwStatement 382 | : Throw expressionSequence eos 383 | ; 384 | 385 | /// TryStatement : 386 | /// try Block Catch 387 | /// try Block Finally 388 | /// try Block Catch Finally 389 | tryStatement 390 | : Try block catchProduction 391 | | Try block finallyProduction 392 | | Try block catchProduction finallyProduction 393 | ; 394 | 395 | /// Catch : 396 | /// catch ( Identifier ) Block 397 | catchProduction 398 | : Catch '(' Identifier ')' block 399 | ; 400 | 401 | /// Finally : 402 | /// finally Block 403 | finallyProduction 404 | : Finally block 405 | ; 406 | 407 | /// DebuggerStatement : 408 | /// debugger ; 409 | debuggerStatement 410 | : Debugger eos 411 | ; 412 | 413 | /// FunctionDeclaration : 414 | /// function Identifier ( FormalParameterList? ) { FunctionBody } 415 | functionDeclaration 416 | : Function Identifier '(' formalParameterList? ')' '{' functionBody '}' 417 | ; 418 | 419 | /// FormalParameterList : 420 | /// Identifier 421 | /// FormalParameterList , Identifier 422 | formalParameterList 423 | : Identifier ( ',' Identifier )* 424 | ; 425 | 426 | /// FunctionBody : 427 | /// SourceElements? 428 | functionBody 429 | : sourceElements? 430 | ; 431 | 432 | /// ArrayLiteral : 433 | /// [ Elision? ] 434 | /// [ ElementList ] 435 | /// [ ElementList , Elision? ] 436 | arrayLiteral 437 | : '[' elementList? ','? elision? ']' 438 | ; 439 | 440 | /// ElementList : 441 | /// Elision? AssignmentExpression 442 | /// ElementList , Elision? AssignmentExpression 443 | elementList 444 | : elision? singleExpression ( ',' elision? singleExpression )* 445 | ; 446 | 447 | /// Elision : 448 | /// , 449 | /// Elision , 450 | elision 451 | : ','+ 452 | ; 453 | 454 | /// ObjectLiteral : 455 | /// { } 456 | /// { PropertyNameAndValueList } 457 | /// { PropertyNameAndValueList , } 458 | objectLiteral 459 | : '{' propertyNameAndValueList? ','? '}' 460 | ; 461 | 462 | /// PropertyNameAndValueList : 463 | /// PropertyAssignment 464 | /// PropertyNameAndValueList , PropertyAssignment 465 | propertyNameAndValueList 466 | : propertyAssignment ( ',' propertyAssignment )* 467 | ; 468 | 469 | /// PropertyAssignment : 470 | /// PropertyName : AssignmentExpression 471 | /// get PropertyName ( ) { FunctionBody } 472 | /// set PropertyName ( PropertySetParameterList ) { FunctionBody } 473 | propertyAssignment 474 | : propertyName ':' singleExpression # PropertyExpressionAssignment 475 | | getter '(' ')' '{' functionBody '}' # PropertyGetter 476 | | setter '(' propertySetParameterList ')' '{' functionBody '}' # PropertySetter 477 | ; 478 | 479 | /// PropertyName : 480 | /// IdentifierName 481 | /// StringLiteral 482 | /// NumericLiteral 483 | propertyName 484 | : identifierName 485 | | StringLiteral 486 | | numericLiteral 487 | ; 488 | 489 | /// PropertySetParameterList : 490 | /// Identifier 491 | propertySetParameterList 492 | : Identifier 493 | ; 494 | 495 | /// Arguments : 496 | /// ( ) 497 | /// ( ArgumentList ) 498 | arguments 499 | : '(' argumentList? ')' 500 | ; 501 | 502 | /// ArgumentList : 503 | /// AssignmentExpression 504 | /// ArgumentList , AssignmentExpression 505 | argumentList 506 | : singleExpression ( ',' singleExpression )* 507 | ; 508 | 509 | /// Expression : 510 | /// AssignmentExpression 511 | /// Expression , AssignmentExpression 512 | /// 513 | /// AssignmentExpression : 514 | /// ConditionalExpression 515 | /// LeftHandSideExpression = AssignmentExpression 516 | /// LeftHandSideExpression AssignmentOperator AssignmentExpression 517 | /// 518 | /// ConditionalExpression : 519 | /// LogicalORExpression 520 | /// LogicalORExpression ? AssignmentExpression : AssignmentExpression 521 | /// 522 | /// LogicalORExpression : 523 | /// LogicalANDExpression 524 | /// LogicalORExpression || LogicalANDExpression 525 | /// 526 | /// LogicalANDExpression : 527 | /// BitwiseORExpression 528 | /// LogicalANDExpression && BitwiseORExpression 529 | /// 530 | /// BitwiseORExpression : 531 | /// BitwiseXORExpression 532 | /// BitwiseORExpression | BitwiseXORExpression 533 | /// 534 | /// BitwiseXORExpression : 535 | /// BitwiseANDExpression 536 | /// BitwiseXORExpression ^ BitwiseANDExpression 537 | /// 538 | /// BitwiseANDExpression : 539 | /// EqualityExpression 540 | /// BitwiseANDExpression & EqualityExpression 541 | /// 542 | /// EqualityExpression : 543 | /// RelationalExpression 544 | /// EqualityExpression == RelationalExpression 545 | /// EqualityExpression != RelationalExpression 546 | /// EqualityExpression === RelationalExpression 547 | /// EqualityExpression !== RelationalExpression 548 | /// 549 | /// RelationalExpression : 550 | /// ShiftExpression 551 | /// RelationalExpression < ShiftExpression 552 | /// RelationalExpression > ShiftExpression 553 | /// RelationalExpression <= ShiftExpression 554 | /// RelationalExpression >= ShiftExpression 555 | /// RelationalExpression instanceof ShiftExpression 556 | /// RelationalExpression in ShiftExpression 557 | /// 558 | /// ShiftExpression : 559 | /// AdditiveExpression 560 | /// ShiftExpression << AdditiveExpression 561 | /// ShiftExpression >> AdditiveExpression 562 | /// ShiftExpression >>> AdditiveExpression 563 | /// 564 | /// AdditiveExpression : 565 | /// MultiplicativeExpression 566 | /// AdditiveExpression + MultiplicativeExpression 567 | /// AdditiveExpression - MultiplicativeExpression 568 | /// 569 | /// MultiplicativeExpression : 570 | /// UnaryExpression 571 | /// MultiplicativeExpression * UnaryExpression 572 | /// MultiplicativeExpression / UnaryExpression 573 | /// MultiplicativeExpression % UnaryExpression 574 | /// 575 | /// UnaryExpression : 576 | /// PostfixExpression 577 | /// delete UnaryExpression 578 | /// void UnaryExpression 579 | /// typeof UnaryExpression 580 | /// ++ UnaryExpression 581 | /// -- UnaryExpression 582 | /// + UnaryExpression 583 | /// - UnaryExpression 584 | /// ~ UnaryExpression 585 | /// ! UnaryExpression 586 | /// 587 | /// PostfixExpression : 588 | /// LeftHandSideExpression 589 | /// LeftHandSideExpression [no LineTerminator here] ++ 590 | /// LeftHandSideExpression [no LineTerminator here] -- 591 | /// 592 | /// LeftHandSideExpression : 593 | /// NewExpression 594 | /// CallExpression 595 | /// 596 | /// CallExpression : 597 | /// MemberExpression Arguments 598 | /// CallExpression Arguments 599 | /// CallExpression [ Expression ] 600 | /// CallExpression . IdentifierName 601 | /// 602 | /// NewExpression : 603 | /// MemberExpression 604 | /// new NewExpression 605 | /// 606 | /// MemberExpression : 607 | /// PrimaryExpression 608 | /// FunctionExpression 609 | /// MemberExpression [ Expression ] 610 | /// MemberExpression . IdentifierName 611 | /// new MemberExpression Arguments 612 | /// 613 | /// FunctionExpression : 614 | /// function Identifier? ( FormalParameterList? ) { FunctionBody } 615 | /// 616 | /// PrimaryExpression : 617 | /// this 618 | /// Identifier 619 | /// Literal 620 | /// ArrayLiteral 621 | /// ObjectLiteral 622 | /// ( Expression ) 623 | /// 624 | expressionSequence 625 | : singleExpression ( ',' singleExpression )* 626 | ; 627 | 628 | singleExpression 629 | : Function Identifier? '(' formalParameterList? ')' '{' functionBody '}' # FunctionExpression 630 | | singleExpression '[' expressionSequence ']' # MemberIndexExpression 631 | | singleExpression '.' identifierName # MemberDotExpression 632 | | singleExpression arguments # ArgumentsExpression 633 | | New singleExpression arguments? # NewExpression 634 | | singleExpression {!here(LineTerminator)}? '++' # PostIncrementExpression 635 | | singleExpression {!here(LineTerminator)}? '--' # PostDecreaseExpression 636 | | Delete singleExpression # DeleteExpression 637 | | Void singleExpression # VoidExpression 638 | | Typeof singleExpression # TypeofExpression 639 | | '++' singleExpression # PreIncrementExpression 640 | | '--' singleExpression # PreDecreaseExpression 641 | | '+' singleExpression # UnaryPlusExpression 642 | | '-' singleExpression # UnaryMinusExpression 643 | | '~' singleExpression # BitNotExpression 644 | | '!' singleExpression # NotExpression 645 | | singleExpression ( '*' | '/' | '%' ) singleExpression # MultiplicativeExpression 646 | | singleExpression ( '+' | '-' ) singleExpression # AdditiveExpression 647 | | singleExpression ( '<<' | '>>' | '>>>' ) singleExpression # BitShiftExpression 648 | | singleExpression ( '<' | '>' | '<=' | '>=' ) singleExpression # RelationalExpression 649 | | singleExpression Instanceof singleExpression # InstanceofExpression 650 | | singleExpression In singleExpression # InExpression 651 | | singleExpression ( '==' | '!=' | '===' | '!==' ) singleExpression # EqualityExpression 652 | | singleExpression '&' singleExpression # BitAndExpression 653 | | singleExpression '^' singleExpression # BitXOrExpression 654 | | singleExpression '|' singleExpression # BitOrExpression 655 | | singleExpression '&&' singleExpression # LogicalAndExpression 656 | | singleExpression '||' singleExpression # LogicalOrExpression 657 | | singleExpression '?' singleExpression ':' singleExpression # TernaryExpression 658 | | singleExpression '=' expressionSequence # AssignmentExpression 659 | | singleExpression assignmentOperator expressionSequence # AssignmentOperatorExpression 660 | | This # ThisExpression 661 | | Identifier # IdentifierExpression 662 | | literal # LiteralExpression 663 | | arrayLiteral # ArrayLiteralExpression 664 | | objectLiteral # ObjectLiteralExpression 665 | | '(' expressionSequence ')' # ParenthesizedExpression 666 | ; 667 | 668 | /// AssignmentOperator : one of 669 | /// *= /= %= += -= <<= >>= >>>= &= ^= |= 670 | assignmentOperator 671 | : '*=' 672 | | '/=' 673 | | '%=' 674 | | '+=' 675 | | '-=' 676 | | '<<=' 677 | | '>>=' 678 | | '>>>=' 679 | | '&=' 680 | | '^=' 681 | | '|=' 682 | ; 683 | 684 | literal 685 | : ( NullLiteral 686 | | BooleanLiteral 687 | | StringLiteral 688 | | RegularExpressionLiteral 689 | ) 690 | | numericLiteral 691 | ; 692 | 693 | numericLiteral 694 | : DecimalLiteral 695 | | HexIntegerLiteral 696 | | OctalIntegerLiteral 697 | ; 698 | 699 | identifierName 700 | : Identifier 701 | | reservedWord 702 | ; 703 | 704 | reservedWord 705 | : keyword 706 | | futureReservedWord 707 | | ( NullLiteral 708 | | BooleanLiteral 709 | ) 710 | ; 711 | 712 | keyword 713 | : Break 714 | | Do 715 | | Instanceof 716 | | Typeof 717 | | Case 718 | | Else 719 | | New 720 | | Var 721 | | Catch 722 | | Finally 723 | | Return 724 | | Void 725 | | Continue 726 | | For 727 | | Switch 728 | | While 729 | | Debugger 730 | | Function 731 | | This 732 | | With 733 | | Default 734 | | If 735 | | Throw 736 | | Delete 737 | | In 738 | | Try 739 | ; 740 | 741 | futureReservedWord 742 | : Class 743 | | Enum 744 | | Extends 745 | | Super 746 | | Const 747 | | Export 748 | | Import 749 | | Implements 750 | | Let 751 | | Private 752 | | Public 753 | | Interface 754 | | Package 755 | | Protected 756 | | Static 757 | | Yield 758 | ; 759 | 760 | getter 761 | : {_input.LT(1).getText().startsWith("get")}? Identifier 762 | ; 763 | 764 | setter 765 | : {_input.LT(1).getText().startsWith("set")}? Identifier 766 | ; 767 | 768 | eos 769 | : SemiColon 770 | | EOF 771 | | {lineTerminatorAhead()}? 772 | | {_input.LT(1).getType() == CloseBrace}? 773 | ; 774 | 775 | eof 776 | : EOF 777 | ; 778 | 779 | /// RegularExpressionLiteral :: 780 | /// / RegularExpressionBody / RegularExpressionFlags 781 | RegularExpressionLiteral 782 | : {isRegexPossible()}? '/' RegularExpressionBody '/' RegularExpressionFlags 783 | ; 784 | 785 | /// 7.3 Line Terminators 786 | LineTerminator 787 | : [\r\n\u2028\u2029] -> channel(HIDDEN) 788 | ; 789 | 790 | OpenBracket : '['; 791 | CloseBracket : ']'; 792 | OpenParen : '('; 793 | CloseParen : ')'; 794 | OpenBrace : '{'; 795 | CloseBrace : '}'; 796 | SemiColon : ';'; 797 | Comma : ','; 798 | Assign : '='; 799 | QuestionMark : '?'; 800 | Colon : ':'; 801 | Dot : '.'; 802 | PlusPlus : '++'; 803 | MinusMinus : '--'; 804 | Plus : '+'; 805 | Minus : '-'; 806 | BitNot : '~'; 807 | Not : '!'; 808 | Multiply : '*'; 809 | Divide : '/'; 810 | Modulus : '%'; 811 | RightShiftArithmetic : '>>'; 812 | LeftShiftArithmetic : '<<'; 813 | RightShiftLogical : '>>>'; 814 | LessThan : '<'; 815 | MoreThan : '>'; 816 | LessThanEquals : '<='; 817 | GreaterThanEquals : '>='; 818 | Equals : '=='; 819 | NotEquals : '!='; 820 | IdentityEquals : '==='; 821 | IdentityNotEquals : '!=='; 822 | BitAnd : '&'; 823 | BitXOr : '^'; 824 | BitOr : '|'; 825 | And : '&&'; 826 | Or : '||'; 827 | MultiplyAssign : '*='; 828 | DivideAssign : '/='; 829 | ModulusAssign : '%='; 830 | PlusAssign : '+='; 831 | MinusAssign : '-='; 832 | LeftShiftArithmeticAssign : '<<='; 833 | RightShiftArithmeticAssign : '>>='; 834 | RightShiftLogicalAssign : '>>>='; 835 | BitAndAssign : '&='; 836 | BitXorAssign : '^='; 837 | BitOrAssign : '|='; 838 | 839 | /// 7.8.1 Null Literals 840 | NullLiteral 841 | : 'null' 842 | ; 843 | 844 | /// 7.8.2 Boolean Literals 845 | BooleanLiteral 846 | : 'true' 847 | | 'false' 848 | ; 849 | 850 | /// 7.8.3 Numeric Literals 851 | DecimalLiteral 852 | : DecimalIntegerLiteral '.' DecimalDigit* ExponentPart? 853 | | '.' DecimalDigit+ ExponentPart? 854 | | DecimalIntegerLiteral ExponentPart? 855 | ; 856 | 857 | /// 7.8.3 Numeric Literals 858 | HexIntegerLiteral 859 | : '0' [xX] HexDigit+ 860 | ; 861 | 862 | OctalIntegerLiteral 863 | : {!strictMode}? '0' OctalDigit+ 864 | ; 865 | 866 | /// 7.6.1.1 Keywords 867 | Break : 'break'; 868 | Do : 'do'; 869 | Instanceof : 'instanceof'; 870 | Typeof : 'typeof'; 871 | Case : 'case'; 872 | Else : 'else'; 873 | New : 'new'; 874 | Var : 'var'; 875 | Catch : 'catch'; 876 | Finally : 'finally'; 877 | Return : 'return'; 878 | Void : 'void'; 879 | Continue : 'continue'; 880 | For : 'for'; 881 | Switch : 'switch'; 882 | While : 'while'; 883 | Debugger : 'debugger'; 884 | Function : 'function'; 885 | This : 'this'; 886 | With : 'with'; 887 | Default : 'default'; 888 | If : 'if'; 889 | Throw : 'throw'; 890 | Delete : 'delete'; 891 | In : 'in'; 892 | Try : 'try'; 893 | 894 | /// 7.6.1.2 Future Reserved Words 895 | Class : 'class'; 896 | Enum : 'enum'; 897 | Extends : 'extends'; 898 | Super : 'super'; 899 | Const : 'const'; 900 | Export : 'export'; 901 | Import : 'import'; 902 | 903 | /// The following tokens are also considered to be FutureReservedWords 904 | /// when parsing strict mode 905 | Implements : {strictMode}? 'implements'; 906 | Let : {strictMode}? 'let'; 907 | Private : {strictMode}? 'private'; 908 | Public : {strictMode}? 'public'; 909 | Interface : {strictMode}? 'interface'; 910 | Package : {strictMode}? 'package'; 911 | Protected : {strictMode}? 'protected'; 912 | Static : {strictMode}? 'static'; 913 | Yield : {strictMode}? 'yield'; 914 | 915 | /// 7.6 Identifier Names and Identifiers 916 | Identifier 917 | : IdentifierStart IdentifierPart* 918 | ; 919 | 920 | /// 7.8.4 String Literals 921 | StringLiteral 922 | : '"' DoubleStringCharacter* '"' 923 | | '\'' SingleStringCharacter* '\'' 924 | ; 925 | 926 | WhiteSpaces 927 | : [\t\u000B\u000C\u0020\u00A0]+ -> channel(HIDDEN) 928 | ; 929 | 930 | /// 7.4 Comments 931 | MultiLineComment 932 | : '/*' .*? '*/' -> channel(HIDDEN) 933 | ; 934 | 935 | SingleLineComment 936 | : '//' ~[\r\n\u2028\u2029]* -> channel(HIDDEN) 937 | ; 938 | 939 | UnexpectedCharacter 940 | : . 941 | ; 942 | 943 | fragment DoubleStringCharacter 944 | : ~["\\\r\n] 945 | | '\\' EscapeSequence 946 | | LineContinuation 947 | ; 948 | 949 | fragment SingleStringCharacter 950 | : ~['\\\r\n] 951 | | '\\' EscapeSequence 952 | | LineContinuation 953 | ; 954 | 955 | fragment EscapeSequence 956 | : CharacterEscapeSequence 957 | | '0' // no digit ahead! TODO 958 | | HexEscapeSequence 959 | | UnicodeEscapeSequence 960 | ; 961 | 962 | fragment CharacterEscapeSequence 963 | : SingleEscapeCharacter 964 | | NonEscapeCharacter 965 | ; 966 | 967 | fragment HexEscapeSequence 968 | : 'x' HexDigit HexDigit 969 | ; 970 | 971 | fragment UnicodeEscapeSequence 972 | : 'u' HexDigit HexDigit HexDigit HexDigit 973 | ; 974 | 975 | fragment SingleEscapeCharacter 976 | : ['"\\bfnrtv] 977 | ; 978 | 979 | fragment NonEscapeCharacter 980 | : ~['"\\bfnrtv0-9xu\r\n] 981 | ; 982 | 983 | fragment EscapeCharacter 984 | : SingleEscapeCharacter 985 | | DecimalDigit 986 | | [xu] 987 | ; 988 | 989 | fragment LineContinuation 990 | : '\\' LineTerminatorSequence 991 | ; 992 | 993 | fragment LineTerminatorSequence 994 | : '\r\n' 995 | | LineTerminator 996 | ; 997 | 998 | fragment DecimalDigit 999 | : [0-9] 1000 | ; 1001 | 1002 | fragment HexDigit 1003 | : [0-9a-fA-F] 1004 | ; 1005 | 1006 | fragment OctalDigit 1007 | : [0-7] 1008 | ; 1009 | 1010 | fragment DecimalIntegerLiteral 1011 | : '0' 1012 | | [1-9] DecimalDigit* 1013 | ; 1014 | 1015 | fragment ExponentPart 1016 | : [eE] [+-]? DecimalDigit+ 1017 | ; 1018 | 1019 | fragment IdentifierStart 1020 | : UnicodeLetter 1021 | | [$_] 1022 | | '\\' UnicodeEscapeSequence 1023 | ; 1024 | 1025 | fragment IdentifierPart 1026 | : IdentifierStart 1027 | | UnicodeCombiningMark 1028 | | UnicodeDigit 1029 | | UnicodeConnectorPunctuation 1030 | | ZWNJ 1031 | | ZWJ 1032 | ; 1033 | 1034 | fragment UnicodeLetter 1035 | : [\u0041-\u005A] 1036 | | [\u0061-\u007A] 1037 | | [\u00AA] 1038 | | [\u00B5] 1039 | | [\u00BA] 1040 | | [\u00C0-\u00D6] 1041 | | [\u00D8-\u00F6] 1042 | | [\u00F8-\u021F] 1043 | | [\u0222-\u0233] 1044 | | [\u0250-\u02AD] 1045 | | [\u02B0-\u02B8] 1046 | | [\u02BB-\u02C1] 1047 | | [\u02D0-\u02D1] 1048 | | [\u02E0-\u02E4] 1049 | | [\u02EE] 1050 | | [\u037A] 1051 | | [\u0386] 1052 | | [\u0388-\u038A] 1053 | | [\u038C] 1054 | | [\u038E-\u03A1] 1055 | | [\u03A3-\u03CE] 1056 | | [\u03D0-\u03D7] 1057 | | [\u03DA-\u03F3] 1058 | | [\u0400-\u0481] 1059 | | [\u048C-\u04C4] 1060 | | [\u04C7-\u04C8] 1061 | | [\u04CB-\u04CC] 1062 | | [\u04D0-\u04F5] 1063 | | [\u04F8-\u04F9] 1064 | | [\u0531-\u0556] 1065 | | [\u0559] 1066 | | [\u0561-\u0587] 1067 | | [\u05D0-\u05EA] 1068 | | [\u05F0-\u05F2] 1069 | | [\u0621-\u063A] 1070 | | [\u0640-\u064A] 1071 | | [\u0671-\u06D3] 1072 | | [\u06D5] 1073 | | [\u06E5-\u06E6] 1074 | | [\u06FA-\u06FC] 1075 | | [\u0710] 1076 | | [\u0712-\u072C] 1077 | | [\u0780-\u07A5] 1078 | | [\u0905-\u0939] 1079 | | [\u093D] 1080 | | [\u0950] 1081 | | [\u0958-\u0961] 1082 | | [\u0985-\u098C] 1083 | | [\u098F-\u0990] 1084 | | [\u0993-\u09A8] 1085 | | [\u09AA-\u09B0] 1086 | | [\u09B2] 1087 | | [\u09B6-\u09B9] 1088 | | [\u09DC-\u09DD] 1089 | | [\u09DF-\u09E1] 1090 | | [\u09F0-\u09F1] 1091 | | [\u0A05-\u0A0A] 1092 | | [\u0A0F-\u0A10] 1093 | | [\u0A13-\u0A28] 1094 | | [\u0A2A-\u0A30] 1095 | | [\u0A32-\u0A33] 1096 | | [\u0A35-\u0A36] 1097 | | [\u0A38-\u0A39] 1098 | | [\u0A59-\u0A5C] 1099 | | [\u0A5E] 1100 | | [\u0A72-\u0A74] 1101 | | [\u0A85-\u0A8B] 1102 | | [\u0A8D] 1103 | | [\u0A8F-\u0A91] 1104 | | [\u0A93-\u0AA8] 1105 | | [\u0AAA-\u0AB0] 1106 | | [\u0AB2-\u0AB3] 1107 | | [\u0AB5-\u0AB9] 1108 | | [\u0ABD] 1109 | | [\u0AD0] 1110 | | [\u0AE0] 1111 | | [\u0B05-\u0B0C] 1112 | | [\u0B0F-\u0B10] 1113 | | [\u0B13-\u0B28] 1114 | | [\u0B2A-\u0B30] 1115 | | [\u0B32-\u0B33] 1116 | | [\u0B36-\u0B39] 1117 | | [\u0B3D] 1118 | | [\u0B5C-\u0B5D] 1119 | | [\u0B5F-\u0B61] 1120 | | [\u0B85-\u0B8A] 1121 | | [\u0B8E-\u0B90] 1122 | | [\u0B92-\u0B95] 1123 | | [\u0B99-\u0B9A] 1124 | | [\u0B9C] 1125 | | [\u0B9E-\u0B9F] 1126 | | [\u0BA3-\u0BA4] 1127 | | [\u0BA8-\u0BAA] 1128 | | [\u0BAE-\u0BB5] 1129 | | [\u0BB7-\u0BB9] 1130 | | [\u0C05-\u0C0C] 1131 | | [\u0C0E-\u0C10] 1132 | | [\u0C12-\u0C28] 1133 | | [\u0C2A-\u0C33] 1134 | | [\u0C35-\u0C39] 1135 | | [\u0C60-\u0C61] 1136 | | [\u0C85-\u0C8C] 1137 | | [\u0C8E-\u0C90] 1138 | | [\u0C92-\u0CA8] 1139 | | [\u0CAA-\u0CB3] 1140 | | [\u0CB5-\u0CB9] 1141 | | [\u0CDE] 1142 | | [\u0CE0-\u0CE1] 1143 | | [\u0D05-\u0D0C] 1144 | | [\u0D0E-\u0D10] 1145 | | [\u0D12-\u0D28] 1146 | | [\u0D2A-\u0D39] 1147 | | [\u0D60-\u0D61] 1148 | | [\u0D85-\u0D96] 1149 | | [\u0D9A-\u0DB1] 1150 | | [\u0DB3-\u0DBB] 1151 | | [\u0DBD] 1152 | | [\u0DC0-\u0DC6] 1153 | | [\u0E01-\u0E30] 1154 | | [\u0E32-\u0E33] 1155 | | [\u0E40-\u0E46] 1156 | | [\u0E81-\u0E82] 1157 | | [\u0E84] 1158 | | [\u0E87-\u0E88] 1159 | | [\u0E8A] 1160 | | [\u0E8D] 1161 | | [\u0E94-\u0E97] 1162 | | [\u0E99-\u0E9F] 1163 | | [\u0EA1-\u0EA3] 1164 | | [\u0EA5] 1165 | | [\u0EA7] 1166 | | [\u0EAA-\u0EAB] 1167 | | [\u0EAD-\u0EB0] 1168 | | [\u0EB2-\u0EB3] 1169 | | [\u0EBD-\u0EC4] 1170 | | [\u0EC6] 1171 | | [\u0EDC-\u0EDD] 1172 | | [\u0F00] 1173 | | [\u0F40-\u0F6A] 1174 | | [\u0F88-\u0F8B] 1175 | | [\u1000-\u1021] 1176 | | [\u1023-\u1027] 1177 | | [\u1029-\u102A] 1178 | | [\u1050-\u1055] 1179 | | [\u10A0-\u10C5] 1180 | | [\u10D0-\u10F6] 1181 | | [\u1100-\u1159] 1182 | | [\u115F-\u11A2] 1183 | | [\u11A8-\u11F9] 1184 | | [\u1200-\u1206] 1185 | | [\u1208-\u1246] 1186 | | [\u1248] 1187 | | [\u124A-\u124D] 1188 | | [\u1250-\u1256] 1189 | | [\u1258] 1190 | | [\u125A-\u125D] 1191 | | [\u1260-\u1286] 1192 | | [\u1288] 1193 | | [\u128A-\u128D] 1194 | | [\u1290-\u12AE] 1195 | | [\u12B0] 1196 | | [\u12B2-\u12B5] 1197 | | [\u12B8-\u12BE] 1198 | | [\u12C0] 1199 | | [\u12C2-\u12C5] 1200 | | [\u12C8-\u12CE] 1201 | | [\u12D0-\u12D6] 1202 | | [\u12D8-\u12EE] 1203 | | [\u12F0-\u130E] 1204 | | [\u1310] 1205 | | [\u1312-\u1315] 1206 | | [\u1318-\u131E] 1207 | | [\u1320-\u1346] 1208 | | [\u1348-\u135A] 1209 | | [\u13A0-\u13B0] 1210 | | [\u13B1-\u13F4] 1211 | | [\u1401-\u1676] 1212 | | [\u1681-\u169A] 1213 | | [\u16A0-\u16EA] 1214 | | [\u1780-\u17B3] 1215 | | [\u1820-\u1877] 1216 | | [\u1880-\u18A8] 1217 | | [\u1E00-\u1E9B] 1218 | | [\u1EA0-\u1EE0] 1219 | | [\u1EE1-\u1EF9] 1220 | | [\u1F00-\u1F15] 1221 | | [\u1F18-\u1F1D] 1222 | | [\u1F20-\u1F39] 1223 | | [\u1F3A-\u1F45] 1224 | | [\u1F48-\u1F4D] 1225 | | [\u1F50-\u1F57] 1226 | | [\u1F59] 1227 | | [\u1F5B] 1228 | | [\u1F5D] 1229 | | [\u1F5F-\u1F7D] 1230 | | [\u1F80-\u1FB4] 1231 | | [\u1FB6-\u1FBC] 1232 | | [\u1FBE] 1233 | | [\u1FC2-\u1FC4] 1234 | | [\u1FC6-\u1FCC] 1235 | | [\u1FD0-\u1FD3] 1236 | | [\u1FD6-\u1FDB] 1237 | | [\u1FE0-\u1FEC] 1238 | | [\u1FF2-\u1FF4] 1239 | | [\u1FF6-\u1FFC] 1240 | | [\u207F] 1241 | | [\u2102] 1242 | | [\u2107] 1243 | | [\u210A-\u2113] 1244 | | [\u2115] 1245 | | [\u2119-\u211D] 1246 | | [\u2124] 1247 | | [\u2126] 1248 | | [\u2128] 1249 | | [\u212A-\u212D] 1250 | | [\u212F-\u2131] 1251 | | [\u2133-\u2139] 1252 | | [\u2160-\u2183] 1253 | | [\u3005-\u3007] 1254 | | [\u3021-\u3029] 1255 | | [\u3031-\u3035] 1256 | | [\u3038-\u303A] 1257 | | [\u3041-\u3094] 1258 | | [\u309D-\u309E] 1259 | | [\u30A1-\u30FA] 1260 | | [\u30FC-\u30FE] 1261 | | [\u3105-\u312C] 1262 | | [\u3131-\u318E] 1263 | | [\u31A0-\u31B7] 1264 | | [\u3400] 1265 | | [\u4DB5] 1266 | | [\u4E00] 1267 | | [\u9FA5] 1268 | | [\uA000-\uA48C] 1269 | | [\uAC00] 1270 | | [\uD7A3] 1271 | | [\uF900-\uFA2D] 1272 | | [\uFB00-\uFB06] 1273 | | [\uFB13-\uFB17] 1274 | | [\uFB1D] 1275 | | [\uFB1F-\uFB28] 1276 | | [\uFB2A-\uFB36] 1277 | | [\uFB38-\uFB3C] 1278 | | [\uFB3E] 1279 | | [\uFB40-\uFB41] 1280 | | [\uFB43-\uFB44] 1281 | | [\uFB46-\uFBB1] 1282 | | [\uFBD3-\uFD3D] 1283 | | [\uFD50-\uFD8F] 1284 | | [\uFD92-\uFDC7] 1285 | | [\uFDF0-\uFDFB] 1286 | | [\uFE70-\uFE72] 1287 | | [\uFE74] 1288 | | [\uFE76-\uFEFC] 1289 | | [\uFF21-\uFF3A] 1290 | | [\uFF41-\uFF5A] 1291 | | [\uFF66-\uFFBE] 1292 | | [\uFFC2-\uFFC7] 1293 | | [\uFFCA-\uFFCF] 1294 | | [\uFFD2-\uFFD7] 1295 | | [\uFFDA-\uFFDC] 1296 | ; 1297 | 1298 | fragment UnicodeCombiningMark 1299 | : [\u0300-\u034E] 1300 | | [\u0360-\u0362] 1301 | | [\u0483-\u0486] 1302 | | [\u0591-\u05A1] 1303 | | [\u05A3-\u05B9] 1304 | | [\u05BB-\u05BD] 1305 | | [\u05BF] 1306 | | [\u05C1-\u05C2] 1307 | | [\u05C4] 1308 | | [\u064B-\u0655] 1309 | | [\u0670] 1310 | | [\u06D6-\u06DC] 1311 | | [\u06DF-\u06E4] 1312 | | [\u06E7-\u06E8] 1313 | | [\u06EA-\u06ED] 1314 | | [\u0711] 1315 | | [\u0730-\u074A] 1316 | | [\u07A6-\u07B0] 1317 | | [\u0901-\u0903] 1318 | | [\u093C] 1319 | | [\u093E-\u094D] 1320 | | [\u0951-\u0954] 1321 | | [\u0962-\u0963] 1322 | | [\u0981-\u0983] 1323 | | [\u09BC-\u09C4] 1324 | | [\u09C7-\u09C8] 1325 | | [\u09CB-\u09CD] 1326 | | [\u09D7] 1327 | | [\u09E2-\u09E3] 1328 | | [\u0A02] 1329 | | [\u0A3C] 1330 | | [\u0A3E-\u0A42] 1331 | | [\u0A47-\u0A48] 1332 | | [\u0A4B-\u0A4D] 1333 | | [\u0A70-\u0A71] 1334 | | [\u0A81-\u0A83] 1335 | | [\u0ABC] 1336 | | [\u0ABE-\u0AC5] 1337 | | [\u0AC7-\u0AC9] 1338 | | [\u0ACB-\u0ACD] 1339 | | [\u0B01-\u0B03] 1340 | | [\u0B3C] 1341 | | [\u0B3E-\u0B43] 1342 | | [\u0B47-\u0B48] 1343 | | [\u0B4B-\u0B4D] 1344 | | [\u0B56-\u0B57] 1345 | | [\u0B82-\u0B83] 1346 | | [\u0BBE-\u0BC2] 1347 | | [\u0BC6-\u0BC8] 1348 | | [\u0BCA-\u0BCD] 1349 | | [\u0BD7] 1350 | | [\u0C01-\u0C03] 1351 | | [\u0C3E-\u0C44] 1352 | | [\u0C46-\u0C48] 1353 | | [\u0C4A-\u0C4D] 1354 | | [\u0C55-\u0C56] 1355 | | [\u0C82-\u0C83] 1356 | | [\u0CBE-\u0CC4] 1357 | | [\u0CC6-\u0CC8] 1358 | | [\u0CCA-\u0CCD] 1359 | | [\u0CD5-\u0CD6] 1360 | | [\u0D02-\u0D03] 1361 | | [\u0D3E-\u0D43] 1362 | | [\u0D46-\u0D48] 1363 | | [\u0D4A-\u0D4D] 1364 | | [\u0D57] 1365 | | [\u0D82-\u0D83] 1366 | | [\u0DCA] 1367 | | [\u0DCF-\u0DD4] 1368 | | [\u0DD6] 1369 | | [\u0DD8-\u0DDF] 1370 | | [\u0DF2-\u0DF3] 1371 | | [\u0E31] 1372 | | [\u0E34-\u0E3A] 1373 | | [\u0E47-\u0E4E] 1374 | | [\u0EB1] 1375 | | [\u0EB4-\u0EB9] 1376 | | [\u0EBB-\u0EBC] 1377 | | [\u0EC8-\u0ECD] 1378 | | [\u0F18-\u0F19] 1379 | | [\u0F35] 1380 | | [\u0F37] 1381 | | [\u0F39] 1382 | | [\u0F3E-\u0F3F] 1383 | | [\u0F71-\u0F84] 1384 | | [\u0F86-\u0F87] 1385 | | [\u0F90-\u0F97] 1386 | | [\u0F99-\u0FBC] 1387 | | [\u0FC6] 1388 | | [\u102C-\u1032] 1389 | | [\u1036-\u1039] 1390 | | [\u1056-\u1059] 1391 | | [\u17B4-\u17D3] 1392 | | [\u18A9] 1393 | | [\u20D0-\u20DC] 1394 | | [\u20E1] 1395 | | [\u302A-\u302F] 1396 | | [\u3099-\u309A] 1397 | | [\uFB1E] 1398 | | [\uFE20-\uFE23] 1399 | ; 1400 | 1401 | fragment UnicodeDigit 1402 | : [\u0030-\u0039] 1403 | | [\u0660-\u0669] 1404 | | [\u06F0-\u06F9] 1405 | | [\u0966-\u096F] 1406 | | [\u09E6-\u09EF] 1407 | | [\u0A66-\u0A6F] 1408 | | [\u0AE6-\u0AEF] 1409 | | [\u0B66-\u0B6F] 1410 | | [\u0BE7-\u0BEF] 1411 | | [\u0C66-\u0C6F] 1412 | | [\u0CE6-\u0CEF] 1413 | | [\u0D66-\u0D6F] 1414 | | [\u0E50-\u0E59] 1415 | | [\u0ED0-\u0ED9] 1416 | | [\u0F20-\u0F29] 1417 | | [\u1040-\u1049] 1418 | | [\u1369-\u1371] 1419 | | [\u17E0-\u17E9] 1420 | | [\u1810-\u1819] 1421 | | [\uFF10-\uFF19] 1422 | ; 1423 | 1424 | fragment UnicodeConnectorPunctuation 1425 | : [\u005F] 1426 | | [\u203F-\u2040] 1427 | | [\u30FB] 1428 | | [\uFE33-\uFE34] 1429 | | [\uFE4D-\uFE4F] 1430 | | [\uFF3F] 1431 | | [\uFF65] 1432 | ; 1433 | 1434 | fragment ZWNJ 1435 | : '\u200C' 1436 | ; 1437 | 1438 | fragment ZWJ 1439 | : '\u200D' 1440 | ; 1441 | 1442 | /// RegularExpressionBody :: 1443 | /// RegularExpressionFirstChar RegularExpressionChars 1444 | /// 1445 | /// RegularExpressionChars :: 1446 | /// [empty] 1447 | /// RegularExpressionChars RegularExpressionChar 1448 | fragment RegularExpressionBody 1449 | : RegularExpressionFirstChar RegularExpressionChar* 1450 | ; 1451 | 1452 | /// RegularExpressionFlags :: 1453 | /// [empty] 1454 | /// RegularExpressionFlags IdentifierPart 1455 | fragment RegularExpressionFlags 1456 | : IdentifierPart* 1457 | ; 1458 | 1459 | /// RegularExpressionFirstChar :: 1460 | /// RegularExpressionNonTerminator but not one of * or \ or / or [ 1461 | /// RegularExpressionBackslashSequence 1462 | /// RegularExpressionClass 1463 | fragment RegularExpressionFirstChar 1464 | : ~[\r\n\u2028\u2029*\\/\[] 1465 | | RegularExpressionBackslashSequence 1466 | | RegularExpressionClass 1467 | ; 1468 | 1469 | /// RegularExpressionChar :: 1470 | /// RegularExpressionNonTerminator but not \ or / or [ 1471 | /// RegularExpressionBackslashSequence 1472 | /// RegularExpressionClass 1473 | fragment RegularExpressionChar 1474 | : ~[\r\n\u2028\u2029\\/\[] 1475 | | RegularExpressionBackslashSequence 1476 | | RegularExpressionClass 1477 | ; 1478 | 1479 | /// RegularExpressionNonTerminator :: 1480 | /// SourceCharacter but not LineTerminator 1481 | fragment RegularExpressionNonTerminator 1482 | : ~[\r\n\u2028\u2029] 1483 | ; 1484 | 1485 | /// RegularExpressionBackslashSequence :: 1486 | /// \ RegularExpressionNonTerminator 1487 | fragment RegularExpressionBackslashSequence 1488 | : '\\' RegularExpressionNonTerminator 1489 | ; 1490 | 1491 | /// RegularExpressionClass :: 1492 | /// [ RegularExpressionClassChars ] 1493 | /// 1494 | /// RegularExpressionClassChars :: 1495 | /// [empty] 1496 | /// RegularExpressionClassChars RegularExpressionClassChar 1497 | fragment RegularExpressionClass 1498 | : '[' RegularExpressionClassChar* ']' 1499 | ; 1500 | 1501 | /// RegularExpressionClassChar :: 1502 | /// RegularExpressionNonTerminator but not ] or \ 1503 | /// RegularExpressionBackslashSequence 1504 | fragment RegularExpressionClassChar 1505 | : ~[\r\n\u2028\u2029\]\\] 1506 | | RegularExpressionBackslashSequence 1507 | ; 1508 | -------------------------------------------------------------------------------- /src/main/java/org/netbeans/ts/lexer/ECMAScriptLexer.java: -------------------------------------------------------------------------------- 1 | package org.netbeans.ts.lexer; 2 | 3 | // Generated from C:\Users\gwieleng\jzone\TypeScript\TypeScript\antlr\Antlr\src\antlr\MyGrammar.g by ANTLR 4.5.1 4 | import org.antlr.v4.runtime.Lexer; 5 | import org.antlr.v4.runtime.CharStream; 6 | import org.antlr.v4.runtime.Token; 7 | import org.antlr.v4.runtime.TokenStream; 8 | import org.antlr.v4.runtime.*; 9 | import org.antlr.v4.runtime.atn.*; 10 | import org.antlr.v4.runtime.dfa.DFA; 11 | import org.antlr.v4.runtime.misc.*; 12 | 13 | @SuppressWarnings({"all", "warnings", "unchecked", "unused", "cast"}) 14 | public class ECMAScriptLexer extends Lexer { 15 | static { RuntimeMetaData.checkVersion("4.5.1", RuntimeMetaData.VERSION); } 16 | 17 | protected static final DFA[] _decisionToDFA; 18 | protected static final PredictionContextCache _sharedContextCache = 19 | new PredictionContextCache(); 20 | public static final int 21 | RegularExpressionLiteral=1, LineTerminator=2, OpenBracket=3, CloseBracket=4, 22 | OpenParen=5, CloseParen=6, OpenBrace=7, CloseBrace=8, SemiColon=9, Comma=10, 23 | Assign=11, QuestionMark=12, Colon=13, Dot=14, PlusPlus=15, MinusMinus=16, 24 | Plus=17, Minus=18, BitNot=19, Not=20, Multiply=21, Divide=22, Modulus=23, 25 | RightShiftArithmetic=24, LeftShiftArithmetic=25, RightShiftLogical=26, 26 | LessThan=27, MoreThan=28, LessThanEquals=29, GreaterThanEquals=30, Equals=31, 27 | NotEquals=32, IdentityEquals=33, IdentityNotEquals=34, BitAnd=35, BitXOr=36, 28 | BitOr=37, And=38, Or=39, MultiplyAssign=40, DivideAssign=41, ModulusAssign=42, 29 | PlusAssign=43, MinusAssign=44, LeftShiftArithmeticAssign=45, RightShiftArithmeticAssign=46, 30 | RightShiftLogicalAssign=47, BitAndAssign=48, BitXorAssign=49, BitOrAssign=50, 31 | NullLiteral=51, BooleanLiteral=52, DecimalLiteral=53, HexIntegerLiteral=54, 32 | OctalIntegerLiteral=55, Break=56, Do=57, Instanceof=58, Typeof=59, Case=60, 33 | Else=61, New=62, Var=63, Catch=64, Finally=65, Return=66, Void=67, Continue=68, 34 | For=69, Switch=70, While=71, Debugger=72, Function=73, This=74, With=75, 35 | Default=76, If=77, Throw=78, Delete=79, In=80, Try=81, Class=82, Enum=83, 36 | Extends=84, Super=85, Const=86, Export=87, Import=88, Implements=89, Let=90, 37 | Private=91, Public=92, Interface=93, Package=94, Protected=95, Static=96, 38 | Yield=97, Identifier=98, StringLiteral=99, WhiteSpaces=100, MultiLineComment=101, 39 | SingleLineComment=102, UnexpectedCharacter=103; 40 | public static String[] modeNames = { 41 | "DEFAULT_MODE" 42 | }; 43 | 44 | public static final String[] ruleNames = { 45 | "RegularExpressionLiteral", "LineTerminator", "OpenBracket", "CloseBracket", 46 | "OpenParen", "CloseParen", "OpenBrace", "CloseBrace", "SemiColon", "Comma", 47 | "Assign", "QuestionMark", "Colon", "Dot", "PlusPlus", "MinusMinus", "Plus", 48 | "Minus", "BitNot", "Not", "Multiply", "Divide", "Modulus", "RightShiftArithmetic", 49 | "LeftShiftArithmetic", "RightShiftLogical", "LessThan", "MoreThan", "LessThanEquals", 50 | "GreaterThanEquals", "Equals", "NotEquals", "IdentityEquals", "IdentityNotEquals", 51 | "BitAnd", "BitXOr", "BitOr", "And", "Or", "MultiplyAssign", "DivideAssign", 52 | "ModulusAssign", "PlusAssign", "MinusAssign", "LeftShiftArithmeticAssign", 53 | "RightShiftArithmeticAssign", "RightShiftLogicalAssign", "BitAndAssign", 54 | "BitXorAssign", "BitOrAssign", "NullLiteral", "BooleanLiteral", "DecimalLiteral", 55 | "HexIntegerLiteral", "OctalIntegerLiteral", "Break", "Do", "Instanceof", 56 | "Typeof", "Case", "Else", "New", "Var", "Catch", "Finally", "Return", 57 | "Void", "Continue", "For", "Switch", "While", "Debugger", "Function", 58 | "This", "With", "Default", "If", "Throw", "Delete", "In", "Try", "Class", 59 | "Enum", "Extends", "Super", "Const", "Export", "Import", "Implements", 60 | "Let", "Private", "Public", "Interface", "Package", "Protected", "Static", 61 | "Yield", "Identifier", "StringLiteral", "WhiteSpaces", "MultiLineComment", 62 | "SingleLineComment", "UnexpectedCharacter", "DoubleStringCharacter", "SingleStringCharacter", 63 | "EscapeSequence", "CharacterEscapeSequence", "HexEscapeSequence", "UnicodeEscapeSequence", 64 | "SingleEscapeCharacter", "NonEscapeCharacter", "EscapeCharacter", "LineContinuation", 65 | "LineTerminatorSequence", "DecimalDigit", "HexDigit", "OctalDigit", "DecimalIntegerLiteral", 66 | "ExponentPart", "IdentifierStart", "IdentifierPart", "UnicodeLetter", 67 | "UnicodeCombiningMark", "UnicodeDigit", "UnicodeConnectorPunctuation", 68 | "ZWNJ", "ZWJ", "RegularExpressionBody", "RegularExpressionFlags", "RegularExpressionFirstChar", 69 | "RegularExpressionChar", "RegularExpressionNonTerminator", "RegularExpressionBackslashSequence", 70 | "RegularExpressionClass", "RegularExpressionClassChar" 71 | }; 72 | 73 | private static final String[] _LITERAL_NAMES = { 74 | null, null, null, "'['", "']'", "'('", "')'", "'{'", "'}'", "';'", "','", 75 | "'='", "'?'", "':'", "'.'", "'++'", "'--'", "'+'", "'-'", "'~'", "'!'", 76 | "'*'", "'/'", "'%'", "'>>'", "'<<'", "'>>>'", "'<'", "'>'", "'<='", "'>='", 77 | "'=='", "'!='", "'==='", "'!=='", "'&'", "'^'", "'|'", "'&&'", "'||'", 78 | "'*='", "'/='", "'%='", "'+='", "'-='", "'<<='", "'>>='", "'>>>='", "'&='", 79 | "'^='", "'|='", "'null'", null, null, null, null, "'break'", "'do'", "'instanceof'", 80 | "'typeof'", "'case'", "'else'", "'new'", "'var'", "'catch'", "'finally'", 81 | "'return'", "'void'", "'continue'", "'for'", "'switch'", "'while'", "'debugger'", 82 | "'function'", "'this'", "'with'", "'default'", "'if'", "'throw'", "'delete'", 83 | "'in'", "'try'", "'class'", "'enum'", "'extends'", "'super'", "'const'", 84 | "'export'", "'import'" 85 | }; 86 | private static final String[] _SYMBOLIC_NAMES = { 87 | null, "RegularExpressionLiteral", "LineTerminator", "OpenBracket", "CloseBracket", 88 | "OpenParen", "CloseParen", "OpenBrace", "CloseBrace", "SemiColon", "Comma", 89 | "Assign", "QuestionMark", "Colon", "Dot", "PlusPlus", "MinusMinus", "Plus", 90 | "Minus", "BitNot", "Not", "Multiply", "Divide", "Modulus", "RightShiftArithmetic", 91 | "LeftShiftArithmetic", "RightShiftLogical", "LessThan", "MoreThan", "LessThanEquals", 92 | "GreaterThanEquals", "Equals", "NotEquals", "IdentityEquals", "IdentityNotEquals", 93 | "BitAnd", "BitXOr", "BitOr", "And", "Or", "MultiplyAssign", "DivideAssign", 94 | "ModulusAssign", "PlusAssign", "MinusAssign", "LeftShiftArithmeticAssign", 95 | "RightShiftArithmeticAssign", "RightShiftLogicalAssign", "BitAndAssign", 96 | "BitXorAssign", "BitOrAssign", "NullLiteral", "BooleanLiteral", "DecimalLiteral", 97 | "HexIntegerLiteral", "OctalIntegerLiteral", "Break", "Do", "Instanceof", 98 | "Typeof", "Case", "Else", "New", "Var", "Catch", "Finally", "Return", 99 | "Void", "Continue", "For", "Switch", "While", "Debugger", "Function", 100 | "This", "With", "Default", "If", "Throw", "Delete", "In", "Try", "Class", 101 | "Enum", "Extends", "Super", "Const", "Export", "Import", "Implements", 102 | "Let", "Private", "Public", "Interface", "Package", "Protected", "Static", 103 | "Yield", "Identifier", "StringLiteral", "WhiteSpaces", "MultiLineComment", 104 | "SingleLineComment", "UnexpectedCharacter" 105 | }; 106 | public static final Vocabulary VOCABULARY = new VocabularyImpl(_LITERAL_NAMES, _SYMBOLIC_NAMES); 107 | 108 | /** 109 | * @deprecated Use {@link #VOCABULARY} instead. 110 | */ 111 | @Deprecated 112 | public static final String[] tokenNames; 113 | static { 114 | tokenNames = new String[_SYMBOLIC_NAMES.length]; 115 | for (int i = 0; i < tokenNames.length; i++) { 116 | tokenNames[i] = VOCABULARY.getLiteralName(i); 117 | if (tokenNames[i] == null) { 118 | tokenNames[i] = VOCABULARY.getSymbolicName(i); 119 | } 120 | 121 | if (tokenNames[i] == null) { 122 | tokenNames[i] = ""; 123 | } 124 | } 125 | } 126 | 127 | @Override 128 | @Deprecated 129 | public String[] getTokenNames() { 130 | return tokenNames; 131 | } 132 | 133 | @Override 134 | 135 | public Vocabulary getVocabulary() { 136 | return VOCABULARY; 137 | } 138 | 139 | 140 | 141 | // A flag indicating if the lexer should operate in strict mode. 142 | // When set to true, FutureReservedWords are tokenized, when false, 143 | // an octal literal can be tokenized. 144 | private boolean strictMode = true; 145 | 146 | // The most recently produced token. 147 | private Token lastToken = null; 148 | 149 | /** 150 | * Returns {@code true} iff the lexer operates in strict mode. 151 | * 152 | * @return {@code true} iff the lexer operates in strict mode. 153 | */ 154 | public boolean getStrictMode() { 155 | return this.strictMode; 156 | } 157 | 158 | /** 159 | * Sets whether the lexer operates in strict mode or not. 160 | * 161 | * @param strictMode 162 | * the flag indicating the lexer operates in strict mode or not. 163 | */ 164 | public void setStrictMode(boolean strictMode) { 165 | this.strictMode = strictMode; 166 | } 167 | 168 | /** 169 | * Return the next token from the character stream and records this last 170 | * token in case it resides on the default channel. This recorded token 171 | * is used to determine when the lexer could possibly match a regex 172 | * literal. 173 | * 174 | * @return the next token from the character stream. 175 | */ 176 | @Override 177 | public Token nextToken() { 178 | 179 | // Get the next token. 180 | Token next = super.nextToken(); 181 | 182 | if (next.getChannel() == Token.DEFAULT_CHANNEL) { 183 | // Keep track of the last token on the default channel. 184 | this.lastToken = next; 185 | } 186 | 187 | return next; 188 | } 189 | 190 | /** 191 | * Returns {@code true} iff the lexer can match a regex literal. 192 | * 193 | * @return {@code true} iff the lexer can match a regex literal. 194 | */ 195 | private boolean isRegexPossible() { 196 | 197 | if (this.lastToken == null) { 198 | // No token has been produced yet: at the start of the input, 199 | // no division is possible, so a regex literal _is_ possible. 200 | return true; 201 | } 202 | 203 | switch (this.lastToken.getType()) { 204 | case Identifier: 205 | case NullLiteral: 206 | case BooleanLiteral: 207 | case This: 208 | case CloseBracket: 209 | case CloseParen: 210 | case OctalIntegerLiteral: 211 | case DecimalLiteral: 212 | case HexIntegerLiteral: 213 | case StringLiteral: 214 | // After any of the tokens above, no regex literal can follow. 215 | return false; 216 | default: 217 | // In all other cases, a regex literal _is_ possible. 218 | return true; 219 | } 220 | } 221 | 222 | 223 | public ECMAScriptLexer(CharStream input) { 224 | super(input); 225 | _interp = new LexerATNSimulator(this,_ATN,_decisionToDFA,_sharedContextCache); 226 | } 227 | 228 | @Override 229 | public String getGrammarFileName() { return "MyGrammar.g"; } 230 | 231 | @Override 232 | public String[] getRuleNames() { return ruleNames; } 233 | 234 | @Override 235 | public String getSerializedATN() { return _serializedATN; } 236 | 237 | @Override 238 | public String[] getModeNames() { return modeNames; } 239 | 240 | @Override 241 | public ATN getATN() { return _ATN; } 242 | 243 | @Override 244 | public boolean sempred(RuleContext _localctx, int ruleIndex, int predIndex) { 245 | switch (ruleIndex) { 246 | case 0: 247 | return RegularExpressionLiteral_sempred((RuleContext)_localctx, predIndex); 248 | case 54: 249 | return OctalIntegerLiteral_sempred((RuleContext)_localctx, predIndex); 250 | case 88: 251 | return Implements_sempred((RuleContext)_localctx, predIndex); 252 | case 89: 253 | return Let_sempred((RuleContext)_localctx, predIndex); 254 | case 90: 255 | return Private_sempred((RuleContext)_localctx, predIndex); 256 | case 91: 257 | return Public_sempred((RuleContext)_localctx, predIndex); 258 | case 92: 259 | return Interface_sempred((RuleContext)_localctx, predIndex); 260 | case 93: 261 | return Package_sempred((RuleContext)_localctx, predIndex); 262 | case 94: 263 | return Protected_sempred((RuleContext)_localctx, predIndex); 264 | case 95: 265 | return Static_sempred((RuleContext)_localctx, predIndex); 266 | case 96: 267 | return Yield_sempred((RuleContext)_localctx, predIndex); 268 | } 269 | return true; 270 | } 271 | private boolean RegularExpressionLiteral_sempred(RuleContext _localctx, int predIndex) { 272 | switch (predIndex) { 273 | case 0: 274 | return isRegexPossible(); 275 | } 276 | return true; 277 | } 278 | private boolean OctalIntegerLiteral_sempred(RuleContext _localctx, int predIndex) { 279 | switch (predIndex) { 280 | case 1: 281 | return !strictMode; 282 | } 283 | return true; 284 | } 285 | private boolean Implements_sempred(RuleContext _localctx, int predIndex) { 286 | switch (predIndex) { 287 | case 2: 288 | return strictMode; 289 | } 290 | return true; 291 | } 292 | private boolean Let_sempred(RuleContext _localctx, int predIndex) { 293 | switch (predIndex) { 294 | case 3: 295 | return strictMode; 296 | } 297 | return true; 298 | } 299 | private boolean Private_sempred(RuleContext _localctx, int predIndex) { 300 | switch (predIndex) { 301 | case 4: 302 | return strictMode; 303 | } 304 | return true; 305 | } 306 | private boolean Public_sempred(RuleContext _localctx, int predIndex) { 307 | switch (predIndex) { 308 | case 5: 309 | return strictMode; 310 | } 311 | return true; 312 | } 313 | private boolean Interface_sempred(RuleContext _localctx, int predIndex) { 314 | switch (predIndex) { 315 | case 6: 316 | return strictMode; 317 | } 318 | return true; 319 | } 320 | private boolean Package_sempred(RuleContext _localctx, int predIndex) { 321 | switch (predIndex) { 322 | case 7: 323 | return strictMode; 324 | } 325 | return true; 326 | } 327 | private boolean Protected_sempred(RuleContext _localctx, int predIndex) { 328 | switch (predIndex) { 329 | case 8: 330 | return strictMode; 331 | } 332 | return true; 333 | } 334 | private boolean Static_sempred(RuleContext _localctx, int predIndex) { 335 | switch (predIndex) { 336 | case 9: 337 | return strictMode; 338 | } 339 | return true; 340 | } 341 | private boolean Yield_sempred(RuleContext _localctx, int predIndex) { 342 | switch (predIndex) { 343 | case 10: 344 | return strictMode; 345 | } 346 | return true; 347 | } 348 | 349 | public static final String _serializedATN = 350 | "\3\u0430\ud6d1\u8206\uad2d\u4417\uaef1\u8d80\uaadd\2i\u03b7\b\1\4\2\t"+ 351 | "\2\4\3\t\3\4\4\t\4\4\5\t\5\4\6\t\6\4\7\t\7\4\b\t\b\4\t\t\t\4\n\t\n\4\13"+ 352 | "\t\13\4\f\t\f\4\r\t\r\4\16\t\16\4\17\t\17\4\20\t\20\4\21\t\21\4\22\t\22"+ 353 | "\4\23\t\23\4\24\t\24\4\25\t\25\4\26\t\26\4\27\t\27\4\30\t\30\4\31\t\31"+ 354 | "\4\32\t\32\4\33\t\33\4\34\t\34\4\35\t\35\4\36\t\36\4\37\t\37\4 \t \4!"+ 355 | "\t!\4\"\t\"\4#\t#\4$\t$\4%\t%\4&\t&\4\'\t\'\4(\t(\4)\t)\4*\t*\4+\t+\4"+ 356 | ",\t,\4-\t-\4.\t.\4/\t/\4\60\t\60\4\61\t\61\4\62\t\62\4\63\t\63\4\64\t"+ 357 | "\64\4\65\t\65\4\66\t\66\4\67\t\67\48\t8\49\t9\4:\t:\4;\t;\4<\t<\4=\t="+ 358 | "\4>\t>\4?\t?\4@\t@\4A\tA\4B\tB\4C\tC\4D\tD\4E\tE\4F\tF\4G\tG\4H\tH\4I"+ 359 | "\tI\4J\tJ\4K\tK\4L\tL\4M\tM\4N\tN\4O\tO\4P\tP\4Q\tQ\4R\tR\4S\tS\4T\tT"+ 360 | "\4U\tU\4V\tV\4W\tW\4X\tX\4Y\tY\4Z\tZ\4[\t[\4\\\t\\\4]\t]\4^\t^\4_\t_\4"+ 361 | "`\t`\4a\ta\4b\tb\4c\tc\4d\td\4e\te\4f\tf\4g\tg\4h\th\4i\ti\4j\tj\4k\t"+ 362 | "k\4l\tl\4m\tm\4n\tn\4o\to\4p\tp\4q\tq\4r\tr\4s\ts\4t\tt\4u\tu\4v\tv\4"+ 363 | "w\tw\4x\tx\4y\ty\4z\tz\4{\t{\4|\t|\4}\t}\4~\t~\4\177\t\177\4\u0080\t\u0080"+ 364 | "\4\u0081\t\u0081\4\u0082\t\u0082\4\u0083\t\u0083\4\u0084\t\u0084\4\u0085"+ 365 | "\t\u0085\4\u0086\t\u0086\4\u0087\t\u0087\4\u0088\t\u0088\3\2\3\2\3\2\3"+ 366 | "\2\3\2\3\2\3\3\3\3\3\3\3\3\3\4\3\4\3\5\3\5\3\6\3\6\3\7\3\7\3\b\3\b\3\t"+ 367 | "\3\t\3\n\3\n\3\13\3\13\3\f\3\f\3\r\3\r\3\16\3\16\3\17\3\17\3\20\3\20\3"+ 368 | "\20\3\21\3\21\3\21\3\22\3\22\3\23\3\23\3\24\3\24\3\25\3\25\3\26\3\26\3"+ 369 | "\27\3\27\3\30\3\30\3\31\3\31\3\31\3\32\3\32\3\32\3\33\3\33\3\33\3\33\3"+ 370 | "\34\3\34\3\35\3\35\3\36\3\36\3\36\3\37\3\37\3\37\3 \3 \3 \3!\3!\3!\3\""+ 371 | "\3\"\3\"\3\"\3#\3#\3#\3#\3$\3$\3%\3%\3&\3&\3\'\3\'\3\'\3(\3(\3(\3)\3)"+ 372 | "\3)\3*\3*\3*\3+\3+\3+\3,\3,\3,\3-\3-\3-\3.\3.\3.\3.\3/\3/\3/\3/\3\60\3"+ 373 | "\60\3\60\3\60\3\60\3\61\3\61\3\61\3\62\3\62\3\62\3\63\3\63\3\63\3\64\3"+ 374 | "\64\3\64\3\64\3\64\3\65\3\65\3\65\3\65\3\65\3\65\3\65\3\65\3\65\5\65\u01a9"+ 375 | "\n\65\3\66\3\66\3\66\7\66\u01ae\n\66\f\66\16\66\u01b1\13\66\3\66\5\66"+ 376 | "\u01b4\n\66\3\66\3\66\6\66\u01b8\n\66\r\66\16\66\u01b9\3\66\5\66\u01bd"+ 377 | "\n\66\3\66\3\66\5\66\u01c1\n\66\5\66\u01c3\n\66\3\67\3\67\3\67\6\67\u01c8"+ 378 | "\n\67\r\67\16\67\u01c9\38\38\38\68\u01cf\n8\r8\168\u01d0\39\39\39\39\3"+ 379 | "9\39\3:\3:\3:\3;\3;\3;\3;\3;\3;\3;\3;\3;\3;\3;\3<\3<\3<\3<\3<\3<\3<\3"+ 380 | "=\3=\3=\3=\3=\3>\3>\3>\3>\3>\3?\3?\3?\3?\3@\3@\3@\3@\3A\3A\3A\3A\3A\3"+ 381 | "A\3B\3B\3B\3B\3B\3B\3B\3B\3C\3C\3C\3C\3C\3C\3C\3D\3D\3D\3D\3D\3E\3E\3"+ 382 | "E\3E\3E\3E\3E\3E\3E\3F\3F\3F\3F\3G\3G\3G\3G\3G\3G\3G\3H\3H\3H\3H\3H\3"+ 383 | "H\3I\3I\3I\3I\3I\3I\3I\3I\3I\3J\3J\3J\3J\3J\3J\3J\3J\3J\3K\3K\3K\3K\3"+ 384 | "K\3L\3L\3L\3L\3L\3M\3M\3M\3M\3M\3M\3M\3M\3N\3N\3N\3O\3O\3O\3O\3O\3O\3"+ 385 | "P\3P\3P\3P\3P\3P\3P\3Q\3Q\3Q\3R\3R\3R\3R\3S\3S\3S\3S\3S\3S\3T\3T\3T\3"+ 386 | "T\3T\3U\3U\3U\3U\3U\3U\3U\3U\3V\3V\3V\3V\3V\3V\3W\3W\3W\3W\3W\3W\3X\3"+ 387 | "X\3X\3X\3X\3X\3X\3Y\3Y\3Y\3Y\3Y\3Y\3Y\3Z\3Z\3Z\3Z\3Z\3Z\3Z\3Z\3Z\3Z\3"+ 388 | "Z\3Z\3[\3[\3[\3[\3[\3\\\3\\\3\\\3\\\3\\\3\\\3\\\3\\\3\\\3]\3]\3]\3]\3"+ 389 | "]\3]\3]\3]\3^\3^\3^\3^\3^\3^\3^\3^\3^\3^\3^\3_\3_\3_\3_\3_\3_\3_\3_\3"+ 390 | "_\3`\3`\3`\3`\3`\3`\3`\3`\3`\3`\3`\3a\3a\3a\3a\3a\3a\3a\3a\3b\3b\3b\3"+ 391 | "b\3b\3b\3b\3c\3c\7c\u02ee\nc\fc\16c\u02f1\13c\3d\3d\7d\u02f5\nd\fd\16"+ 392 | "d\u02f8\13d\3d\3d\3d\7d\u02fd\nd\fd\16d\u0300\13d\3d\5d\u0303\nd\3e\6"+ 393 | "e\u0306\ne\re\16e\u0307\3e\3e\3f\3f\3f\3f\7f\u0310\nf\ff\16f\u0313\13"+ 394 | "f\3f\3f\3f\3f\3f\3g\3g\3g\3g\7g\u031e\ng\fg\16g\u0321\13g\3g\3g\3h\3h"+ 395 | "\3i\3i\3i\3i\5i\u032b\ni\3j\3j\3j\3j\5j\u0331\nj\3k\3k\3k\3k\5k\u0337"+ 396 | "\nk\3l\3l\5l\u033b\nl\3m\3m\3m\3m\3n\3n\3n\3n\3n\3n\3o\3o\3p\3p\3q\3q"+ 397 | "\3q\5q\u034e\nq\3r\3r\3r\3s\3s\3s\5s\u0356\ns\3t\3t\3u\3u\3v\3v\3w\3w"+ 398 | "\3w\7w\u0361\nw\fw\16w\u0364\13w\5w\u0366\nw\3x\3x\5x\u036a\nx\3x\6x\u036d"+ 399 | "\nx\rx\16x\u036e\3y\3y\3y\3y\5y\u0375\ny\3z\3z\3z\3z\3z\3z\5z\u037d\n"+ 400 | "z\3{\5{\u0380\n{\3|\5|\u0383\n|\3}\5}\u0386\n}\3~\5~\u0389\n~\3\177\3"+ 401 | "\177\3\u0080\3\u0080\3\u0081\3\u0081\7\u0081\u0391\n\u0081\f\u0081\16"+ 402 | "\u0081\u0394\13\u0081\3\u0082\7\u0082\u0397\n\u0082\f\u0082\16\u0082\u039a"+ 403 | "\13\u0082\3\u0083\3\u0083\3\u0083\5\u0083\u039f\n\u0083\3\u0084\3\u0084"+ 404 | "\3\u0084\5\u0084\u03a4\n\u0084\3\u0085\3\u0085\3\u0086\3\u0086\3\u0086"+ 405 | "\3\u0087\3\u0087\7\u0087\u03ad\n\u0087\f\u0087\16\u0087\u03b0\13\u0087"+ 406 | "\3\u0087\3\u0087\3\u0088\3\u0088\5\u0088\u03b6\n\u0088\3\u0311\2\u0089"+ 407 | "\3\3\5\4\7\5\t\6\13\7\r\b\17\t\21\n\23\13\25\f\27\r\31\16\33\17\35\20"+ 408 | "\37\21!\22#\23%\24\'\25)\26+\27-\30/\31\61\32\63\33\65\34\67\359\36;\37"+ 409 | "= ?!A\"C#E$G%I&K\'M(O)Q*S+U,W-Y.[/]\60_\61a\62c\63e\64g\65i\66k\67m8o"+ 410 | "9q:s;u{?}@\177A\u0081B\u0083C\u0085D\u0087E\u0089F\u008bG\u008dH"+ 411 | "\u008fI\u0091J\u0093K\u0095L\u0097M\u0099N\u009bO\u009dP\u009fQ\u00a1"+ 412 | "R\u00a3S\u00a5T\u00a7U\u00a9V\u00abW\u00adX\u00afY\u00b1Z\u00b3[\u00b5"+ 413 | "\\\u00b7]\u00b9^\u00bb_\u00bd`\u00bfa\u00c1b\u00c3c\u00c5d\u00c7e\u00c9"+ 414 | "f\u00cbg\u00cdh\u00cfi\u00d1\2\u00d3\2\u00d5\2\u00d7\2\u00d9\2\u00db\2"+ 415 | "\u00dd\2\u00df\2\u00e1\2\u00e3\2\u00e5\2\u00e7\2\u00e9\2\u00eb\2\u00ed"+ 416 | "\2\u00ef\2\u00f1\2\u00f3\2\u00f5\2\u00f7\2\u00f9\2\u00fb\2\u00fd\2\u00ff"+ 417 | "\2\u0101\2\u0103\2\u0105\2\u0107\2\u0109\2\u010b\2\u010d\2\u010f\2\3\2"+ 418 | "\30\5\2\f\f\17\17\u202a\u202b\4\2ZZzz\6\2\13\13\r\16\"\"\u00a2\u00a2\6"+ 419 | "\2\f\f\17\17$$^^\6\2\f\f\17\17))^^\13\2$$))^^ddhhppttvvxx\16\2\f\f\17"+ 420 | "\17$$))\62;^^ddhhppttvxzz\4\2wwzz\3\2\62;\5\2\62;CHch\3\2\629\3\2\63;"+ 421 | "\4\2GGgg\4\2--//\4\2&&aa\u0104\2C\\c|\u00ac\u00ac\u00b7\u00b7\u00bc\u00bc"+ 422 | "\u00c2\u00d8\u00da\u00f8\u00fa\u0221\u0224\u0235\u0252\u02af\u02b2\u02ba"+ 423 | "\u02bd\u02c3\u02d2\u02d3\u02e2\u02e6\u02f0\u02f0\u037c\u037c\u0388\u0388"+ 424 | "\u038a\u038c\u038e\u038e\u0390\u03a3\u03a5\u03d0\u03d2\u03d9\u03dc\u03f5"+ 425 | "\u0402\u0483\u048e\u04c6\u04c9\u04ca\u04cd\u04ce\u04d2\u04f7\u04fa\u04fb"+ 426 | "\u0533\u0558\u055b\u055b\u0563\u0589\u05d2\u05ec\u05f2\u05f4\u0623\u063c"+ 427 | "\u0642\u064c\u0673\u06d5\u06d7\u06d7\u06e7\u06e8\u06fc\u06fe\u0712\u0712"+ 428 | "\u0714\u072e\u0782\u07a7\u0907\u093b\u093f\u093f\u0952\u0952\u095a\u0963"+ 429 | "\u0987\u098e\u0991\u0992\u0995\u09aa\u09ac\u09b2\u09b4\u09b4\u09b8\u09bb"+ 430 | "\u09de\u09df\u09e1\u09e3\u09f2\u09f3\u0a07\u0a0c\u0a11\u0a12\u0a15\u0a2a"+ 431 | "\u0a2c\u0a32\u0a34\u0a35\u0a37\u0a38\u0a3a\u0a3b\u0a5b\u0a5e\u0a60\u0a60"+ 432 | "\u0a74\u0a76\u0a87\u0a8d\u0a8f\u0a8f\u0a91\u0a93\u0a95\u0aaa\u0aac\u0ab2"+ 433 | "\u0ab4\u0ab5\u0ab7\u0abb\u0abf\u0abf\u0ad2\u0ad2\u0ae2\u0ae2\u0b07\u0b0e"+ 434 | "\u0b11\u0b12\u0b15\u0b2a\u0b2c\u0b32\u0b34\u0b35\u0b38\u0b3b\u0b3f\u0b3f"+ 435 | "\u0b5e\u0b5f\u0b61\u0b63\u0b87\u0b8c\u0b90\u0b92\u0b94\u0b97\u0b9b\u0b9c"+ 436 | "\u0b9e\u0b9e\u0ba0\u0ba1\u0ba5\u0ba6\u0baa\u0bac\u0bb0\u0bb7\u0bb9\u0bbb"+ 437 | "\u0c07\u0c0e\u0c10\u0c12\u0c14\u0c2a\u0c2c\u0c35\u0c37\u0c3b\u0c62\u0c63"+ 438 | "\u0c87\u0c8e\u0c90\u0c92\u0c94\u0caa\u0cac\u0cb5\u0cb7\u0cbb\u0ce0\u0ce0"+ 439 | "\u0ce2\u0ce3\u0d07\u0d0e\u0d10\u0d12\u0d14\u0d2a\u0d2c\u0d3b\u0d62\u0d63"+ 440 | "\u0d87\u0d98\u0d9c\u0db3\u0db5\u0dbd\u0dbf\u0dbf\u0dc2\u0dc8\u0e03\u0e32"+ 441 | "\u0e34\u0e35\u0e42\u0e48\u0e83\u0e84\u0e86\u0e86\u0e89\u0e8a\u0e8c\u0e8c"+ 442 | "\u0e8f\u0e8f\u0e96\u0e99\u0e9b\u0ea1\u0ea3\u0ea5\u0ea7\u0ea7\u0ea9\u0ea9"+ 443 | "\u0eac\u0ead\u0eaf\u0eb2\u0eb4\u0eb5\u0ebf\u0ec6\u0ec8\u0ec8\u0ede\u0edf"+ 444 | "\u0f02\u0f02\u0f42\u0f6c\u0f8a\u0f8d\u1002\u1023\u1025\u1029\u102b\u102c"+ 445 | "\u1052\u1057\u10a2\u10c7\u10d2\u10f8\u1102\u115b\u1161\u11a4\u11aa\u11fb"+ 446 | "\u1202\u1208\u120a\u1248\u124a\u124a\u124c\u124f\u1252\u1258\u125a\u125a"+ 447 | "\u125c\u125f\u1262\u1288\u128a\u128a\u128c\u128f\u1292\u12b0\u12b2\u12b2"+ 448 | "\u12b4\u12b7\u12ba\u12c0\u12c2\u12c2\u12c4\u12c7\u12ca\u12d0\u12d2\u12d8"+ 449 | "\u12da\u12f0\u12f2\u1310\u1312\u1312\u1314\u1317\u131a\u1320\u1322\u1348"+ 450 | "\u134a\u135c\u13a2\u13f6\u1403\u1678\u1683\u169c\u16a2\u16ec\u1782\u17b5"+ 451 | "\u1822\u1879\u1882\u18aa\u1e02\u1e9d\u1ea2\u1efb\u1f02\u1f17\u1f1a\u1f1f"+ 452 | "\u1f22\u1f47\u1f4a\u1f4f\u1f52\u1f59\u1f5b\u1f5b\u1f5d\u1f5d\u1f5f\u1f5f"+ 453 | "\u1f61\u1f7f\u1f82\u1fb6\u1fb8\u1fbe\u1fc0\u1fc0\u1fc4\u1fc6\u1fc8\u1fce"+ 454 | "\u1fd2\u1fd5\u1fd8\u1fdd\u1fe2\u1fee\u1ff4\u1ff6\u1ff8\u1ffe\u2081\u2081"+ 455 | "\u2104\u2104\u2109\u2109\u210c\u2115\u2117\u2117\u211b\u211f\u2126\u2126"+ 456 | "\u2128\u2128\u212a\u212a\u212c\u212f\u2131\u2133\u2135\u213b\u2162\u2185"+ 457 | "\u3007\u3009\u3023\u302b\u3033\u3037\u303a\u303c\u3043\u3096\u309f\u30a0"+ 458 | "\u30a3\u30fc\u30fe\u3100\u3107\u312e\u3133\u3190\u31a2\u31b9\u3402\u3402"+ 459 | "\u4db7\u4db7\u4e02\u4e02\u9fa7\u9fa7\ua002\ua48e\uac02\uac02\ud7a5\ud7a5"+ 460 | "\uf902\ufa2f\ufb02\ufb08\ufb15\ufb19\ufb1f\ufb1f\ufb21\ufb2a\ufb2c\ufb38"+ 461 | "\ufb3a\ufb3e\ufb40\ufb40\ufb42\ufb43\ufb45\ufb46\ufb48\ufbb3\ufbd5\ufd3f"+ 462 | "\ufd52\ufd91\ufd94\ufdc9\ufdf2\ufdfd\ufe72\ufe74\ufe76\ufe76\ufe78\ufefe"+ 463 | "\uff23\uff3c\uff43\uff5c\uff68\uffc0\uffc4\uffc9\uffcc\uffd1\uffd4\uffd9"+ 464 | "\uffdc\uffdef\2\u0302\u0350\u0362\u0364\u0485\u0488\u0593\u05a3\u05a5"+ 465 | "\u05bb\u05bd\u05bf\u05c1\u05c1\u05c3\u05c4\u05c6\u05c6\u064d\u0657\u0672"+ 466 | "\u0672\u06d8\u06de\u06e1\u06e6\u06e9\u06ea\u06ec\u06ef\u0713\u0713\u0732"+ 467 | "\u074c\u07a8\u07b2\u0903\u0905\u093e\u093e\u0940\u094f\u0953\u0956\u0964"+ 468 | "\u0965\u0983\u0985\u09be\u09c6\u09c9\u09ca\u09cd\u09cf\u09d9\u09d9\u09e4"+ 469 | "\u09e5\u0a04\u0a04\u0a3e\u0a3e\u0a40\u0a44\u0a49\u0a4a\u0a4d\u0a4f\u0a72"+ 470 | "\u0a73\u0a83\u0a85\u0abe\u0abe\u0ac0\u0ac7\u0ac9\u0acb\u0acd\u0acf\u0b03"+ 471 | "\u0b05\u0b3e\u0b3e\u0b40\u0b45\u0b49\u0b4a\u0b4d\u0b4f\u0b58\u0b59\u0b84"+ 472 | "\u0b85\u0bc0\u0bc4\u0bc8\u0bca\u0bcc\u0bcf\u0bd9\u0bd9\u0c03\u0c05\u0c40"+ 473 | "\u0c46\u0c48\u0c4a\u0c4c\u0c4f\u0c57\u0c58\u0c84\u0c85\u0cc0\u0cc6\u0cc8"+ 474 | "\u0cca\u0ccc\u0ccf\u0cd7\u0cd8\u0d04\u0d05\u0d40\u0d45\u0d48\u0d4a\u0d4c"+ 475 | "\u0d4f\u0d59\u0d59\u0d84\u0d85\u0dcc\u0dcc\u0dd1\u0dd6\u0dd8\u0dd8\u0dda"+ 476 | "\u0de1\u0df4\u0df5\u0e33\u0e33\u0e36\u0e3c\u0e49\u0e50\u0eb3\u0eb3\u0eb6"+ 477 | "\u0ebb\u0ebd\u0ebe\u0eca\u0ecf\u0f1a\u0f1b\u0f37\u0f37\u0f39\u0f39\u0f3b"+ 478 | "\u0f3b\u0f40\u0f41\u0f73\u0f86\u0f88\u0f89\u0f92\u0f99\u0f9b\u0fbe\u0fc8"+ 479 | "\u0fc8\u102e\u1034\u1038\u103b\u1058\u105b\u17b6\u17d5\u18ab\u18ab\u20d2"+ 480 | "\u20de\u20e3\u20e3\u302c\u3031\u309b\u309c\ufb20\ufb20\ufe22\ufe25\26"+ 481 | "\2\62;\u0662\u066b\u06f2\u06fb\u0968\u0971\u09e8\u09f1\u0a68\u0a71\u0ae8"+ 482 | "\u0af1\u0b68\u0b71\u0be9\u0bf1\u0c68\u0c71\u0ce8\u0cf1\u0d68\u0d71\u0e52"+ 483 | "\u0e5b\u0ed2\u0edb\u0f22\u0f2b\u1042\u104b\u136b\u1373\u17e2\u17eb\u1812"+ 484 | "\u181b\uff12\uff1b\t\2aa\u2041\u2042\u30fd\u30fd\ufe35\ufe36\ufe4f\ufe51"+ 485 | "\uff41\uff41\uff67\uff67\b\2\f\f\17\17,,\61\61]^\u202a\u202b\7\2\f\f\17"+ 486 | "\17\61\61]^\u202a\u202b\6\2\f\f\17\17^_\u202a\u202b\u03c5\2\3\3\2\2\2"+ 487 | "\2\5\3\2\2\2\2\7\3\2\2\2\2\t\3\2\2\2\2\13\3\2\2\2\2\r\3\2\2\2\2\17\3\2"+ 488 | "\2\2\2\21\3\2\2\2\2\23\3\2\2\2\2\25\3\2\2\2\2\27\3\2\2\2\2\31\3\2\2\2"+ 489 | "\2\33\3\2\2\2\2\35\3\2\2\2\2\37\3\2\2\2\2!\3\2\2\2\2#\3\2\2\2\2%\3\2\2"+ 490 | "\2\2\'\3\2\2\2\2)\3\2\2\2\2+\3\2\2\2\2-\3\2\2\2\2/\3\2\2\2\2\61\3\2\2"+ 491 | "\2\2\63\3\2\2\2\2\65\3\2\2\2\2\67\3\2\2\2\29\3\2\2\2\2;\3\2\2\2\2=\3\2"+ 492 | "\2\2\2?\3\2\2\2\2A\3\2\2\2\2C\3\2\2\2\2E\3\2\2\2\2G\3\2\2\2\2I\3\2\2\2"+ 493 | "\2K\3\2\2\2\2M\3\2\2\2\2O\3\2\2\2\2Q\3\2\2\2\2S\3\2\2\2\2U\3\2\2\2\2W"+ 494 | "\3\2\2\2\2Y\3\2\2\2\2[\3\2\2\2\2]\3\2\2\2\2_\3\2\2\2\2a\3\2\2\2\2c\3\2"+ 495 | "\2\2\2e\3\2\2\2\2g\3\2\2\2\2i\3\2\2\2\2k\3\2\2\2\2m\3\2\2\2\2o\3\2\2\2"+ 496 | "\2q\3\2\2\2\2s\3\2\2\2\2u\3\2\2\2\2w\3\2\2\2\2y\3\2\2\2\2{\3\2\2\2\2}"+ 497 | "\3\2\2\2\2\177\3\2\2\2\2\u0081\3\2\2\2\2\u0083\3\2\2\2\2\u0085\3\2\2\2"+ 498 | "\2\u0087\3\2\2\2\2\u0089\3\2\2\2\2\u008b\3\2\2\2\2\u008d\3\2\2\2\2\u008f"+ 499 | "\3\2\2\2\2\u0091\3\2\2\2\2\u0093\3\2\2\2\2\u0095\3\2\2\2\2\u0097\3\2\2"+ 500 | "\2\2\u0099\3\2\2\2\2\u009b\3\2\2\2\2\u009d\3\2\2\2\2\u009f\3\2\2\2\2\u00a1"+ 501 | "\3\2\2\2\2\u00a3\3\2\2\2\2\u00a5\3\2\2\2\2\u00a7\3\2\2\2\2\u00a9\3\2\2"+ 502 | "\2\2\u00ab\3\2\2\2\2\u00ad\3\2\2\2\2\u00af\3\2\2\2\2\u00b1\3\2\2\2\2\u00b3"+ 503 | "\3\2\2\2\2\u00b5\3\2\2\2\2\u00b7\3\2\2\2\2\u00b9\3\2\2\2\2\u00bb\3\2\2"+ 504 | "\2\2\u00bd\3\2\2\2\2\u00bf\3\2\2\2\2\u00c1\3\2\2\2\2\u00c3\3\2\2\2\2\u00c5"+ 505 | "\3\2\2\2\2\u00c7\3\2\2\2\2\u00c9\3\2\2\2\2\u00cb\3\2\2\2\2\u00cd\3\2\2"+ 506 | "\2\2\u00cf\3\2\2\2\3\u0111\3\2\2\2\5\u0117\3\2\2\2\7\u011b\3\2\2\2\t\u011d"+ 507 | "\3\2\2\2\13\u011f\3\2\2\2\r\u0121\3\2\2\2\17\u0123\3\2\2\2\21\u0125\3"+ 508 | "\2\2\2\23\u0127\3\2\2\2\25\u0129\3\2\2\2\27\u012b\3\2\2\2\31\u012d\3\2"+ 509 | "\2\2\33\u012f\3\2\2\2\35\u0131\3\2\2\2\37\u0133\3\2\2\2!\u0136\3\2\2\2"+ 510 | "#\u0139\3\2\2\2%\u013b\3\2\2\2\'\u013d\3\2\2\2)\u013f\3\2\2\2+\u0141\3"+ 511 | "\2\2\2-\u0143\3\2\2\2/\u0145\3\2\2\2\61\u0147\3\2\2\2\63\u014a\3\2\2\2"+ 512 | "\65\u014d\3\2\2\2\67\u0151\3\2\2\29\u0153\3\2\2\2;\u0155\3\2\2\2=\u0158"+ 513 | "\3\2\2\2?\u015b\3\2\2\2A\u015e\3\2\2\2C\u0161\3\2\2\2E\u0165\3\2\2\2G"+ 514 | "\u0169\3\2\2\2I\u016b\3\2\2\2K\u016d\3\2\2\2M\u016f\3\2\2\2O\u0172\3\2"+ 515 | "\2\2Q\u0175\3\2\2\2S\u0178\3\2\2\2U\u017b\3\2\2\2W\u017e\3\2\2\2Y\u0181"+ 516 | "\3\2\2\2[\u0184\3\2\2\2]\u0188\3\2\2\2_\u018c\3\2\2\2a\u0191\3\2\2\2c"+ 517 | "\u0194\3\2\2\2e\u0197\3\2\2\2g\u019a\3\2\2\2i\u01a8\3\2\2\2k\u01c2\3\2"+ 518 | "\2\2m\u01c4\3\2\2\2o\u01cb\3\2\2\2q\u01d2\3\2\2\2s\u01d8\3\2\2\2u\u01db"+ 519 | "\3\2\2\2w\u01e6\3\2\2\2y\u01ed\3\2\2\2{\u01f2\3\2\2\2}\u01f7\3\2\2\2\177"+ 520 | "\u01fb\3\2\2\2\u0081\u01ff\3\2\2\2\u0083\u0205\3\2\2\2\u0085\u020d\3\2"+ 521 | "\2\2\u0087\u0214\3\2\2\2\u0089\u0219\3\2\2\2\u008b\u0222\3\2\2\2\u008d"+ 522 | "\u0226\3\2\2\2\u008f\u022d\3\2\2\2\u0091\u0233\3\2\2\2\u0093\u023c\3\2"+ 523 | "\2\2\u0095\u0245\3\2\2\2\u0097\u024a\3\2\2\2\u0099\u024f\3\2\2\2\u009b"+ 524 | "\u0257\3\2\2\2\u009d\u025a\3\2\2\2\u009f\u0260\3\2\2\2\u00a1\u0267\3\2"+ 525 | "\2\2\u00a3\u026a\3\2\2\2\u00a5\u026e\3\2\2\2\u00a7\u0274\3\2\2\2\u00a9"+ 526 | "\u0279\3\2\2\2\u00ab\u0281\3\2\2\2\u00ad\u0287\3\2\2\2\u00af\u028d\3\2"+ 527 | "\2\2\u00b1\u0294\3\2\2\2\u00b3\u029b\3\2\2\2\u00b5\u02a7\3\2\2\2\u00b7"+ 528 | "\u02ac\3\2\2\2\u00b9\u02b5\3\2\2\2\u00bb\u02bd\3\2\2\2\u00bd\u02c8\3\2"+ 529 | "\2\2\u00bf\u02d1\3\2\2\2\u00c1\u02dc\3\2\2\2\u00c3\u02e4\3\2\2\2\u00c5"+ 530 | "\u02eb\3\2\2\2\u00c7\u0302\3\2\2\2\u00c9\u0305\3\2\2\2\u00cb\u030b\3\2"+ 531 | "\2\2\u00cd\u0319\3\2\2\2\u00cf\u0324\3\2\2\2\u00d1\u032a\3\2\2\2\u00d3"+ 532 | "\u0330\3\2\2\2\u00d5\u0336\3\2\2\2\u00d7\u033a\3\2\2\2\u00d9\u033c\3\2"+ 533 | "\2\2\u00db\u0340\3\2\2\2\u00dd\u0346\3\2\2\2\u00df\u0348\3\2\2\2\u00e1"+ 534 | "\u034d\3\2\2\2\u00e3\u034f\3\2\2\2\u00e5\u0355\3\2\2\2\u00e7\u0357\3\2"+ 535 | "\2\2\u00e9\u0359\3\2\2\2\u00eb\u035b\3\2\2\2\u00ed\u0365\3\2\2\2\u00ef"+ 536 | "\u0367\3\2\2\2\u00f1\u0374\3\2\2\2\u00f3\u037c\3\2\2\2\u00f5\u037f\3\2"+ 537 | "\2\2\u00f7\u0382\3\2\2\2\u00f9\u0385\3\2\2\2\u00fb\u0388\3\2\2\2\u00fd"+ 538 | "\u038a\3\2\2\2\u00ff\u038c\3\2\2\2\u0101\u038e\3\2\2\2\u0103\u0398\3\2"+ 539 | "\2\2\u0105\u039e\3\2\2\2\u0107\u03a3\3\2\2\2\u0109\u03a5\3\2\2\2\u010b"+ 540 | "\u03a7\3\2\2\2\u010d\u03aa\3\2\2\2\u010f\u03b5\3\2\2\2\u0111\u0112\6\2"+ 541 | "\2\2\u0112\u0113\7\61\2\2\u0113\u0114\5\u0101\u0081\2\u0114\u0115\7\61"+ 542 | "\2\2\u0115\u0116\5\u0103\u0082\2\u0116\4\3\2\2\2\u0117\u0118\t\2\2\2\u0118"+ 543 | "\u0119\3\2\2\2\u0119\u011a\b\3\2\2\u011a\6\3\2\2\2\u011b\u011c\7]\2\2"+ 544 | "\u011c\b\3\2\2\2\u011d\u011e\7_\2\2\u011e\n\3\2\2\2\u011f\u0120\7*\2\2"+ 545 | "\u0120\f\3\2\2\2\u0121\u0122\7+\2\2\u0122\16\3\2\2\2\u0123\u0124\7}\2"+ 546 | "\2\u0124\20\3\2\2\2\u0125\u0126\7\177\2\2\u0126\22\3\2\2\2\u0127\u0128"+ 547 | "\7=\2\2\u0128\24\3\2\2\2\u0129\u012a\7.\2\2\u012a\26\3\2\2\2\u012b\u012c"+ 548 | "\7?\2\2\u012c\30\3\2\2\2\u012d\u012e\7A\2\2\u012e\32\3\2\2\2\u012f\u0130"+ 549 | "\7<\2\2\u0130\34\3\2\2\2\u0131\u0132\7\60\2\2\u0132\36\3\2\2\2\u0133\u0134"+ 550 | "\7-\2\2\u0134\u0135\7-\2\2\u0135 \3\2\2\2\u0136\u0137\7/\2\2\u0137\u0138"+ 551 | "\7/\2\2\u0138\"\3\2\2\2\u0139\u013a\7-\2\2\u013a$\3\2\2\2\u013b\u013c"+ 552 | "\7/\2\2\u013c&\3\2\2\2\u013d\u013e\7\u0080\2\2\u013e(\3\2\2\2\u013f\u0140"+ 553 | "\7#\2\2\u0140*\3\2\2\2\u0141\u0142\7,\2\2\u0142,\3\2\2\2\u0143\u0144\7"+ 554 | "\61\2\2\u0144.\3\2\2\2\u0145\u0146\7\'\2\2\u0146\60\3\2\2\2\u0147\u0148"+ 555 | "\7@\2\2\u0148\u0149\7@\2\2\u0149\62\3\2\2\2\u014a\u014b\7>\2\2\u014b\u014c"+ 556 | "\7>\2\2\u014c\64\3\2\2\2\u014d\u014e\7@\2\2\u014e\u014f\7@\2\2\u014f\u0150"+ 557 | "\7@\2\2\u0150\66\3\2\2\2\u0151\u0152\7>\2\2\u01528\3\2\2\2\u0153\u0154"+ 558 | "\7@\2\2\u0154:\3\2\2\2\u0155\u0156\7>\2\2\u0156\u0157\7?\2\2\u0157<\3"+ 559 | "\2\2\2\u0158\u0159\7@\2\2\u0159\u015a\7?\2\2\u015a>\3\2\2\2\u015b\u015c"+ 560 | "\7?\2\2\u015c\u015d\7?\2\2\u015d@\3\2\2\2\u015e\u015f\7#\2\2\u015f\u0160"+ 561 | "\7?\2\2\u0160B\3\2\2\2\u0161\u0162\7?\2\2\u0162\u0163\7?\2\2\u0163\u0164"+ 562 | "\7?\2\2\u0164D\3\2\2\2\u0165\u0166\7#\2\2\u0166\u0167\7?\2\2\u0167\u0168"+ 563 | "\7?\2\2\u0168F\3\2\2\2\u0169\u016a\7(\2\2\u016aH\3\2\2\2\u016b\u016c\7"+ 564 | "`\2\2\u016cJ\3\2\2\2\u016d\u016e\7~\2\2\u016eL\3\2\2\2\u016f\u0170\7("+ 565 | "\2\2\u0170\u0171\7(\2\2\u0171N\3\2\2\2\u0172\u0173\7~\2\2\u0173\u0174"+ 566 | "\7~\2\2\u0174P\3\2\2\2\u0175\u0176\7,\2\2\u0176\u0177\7?\2\2\u0177R\3"+ 567 | "\2\2\2\u0178\u0179\7\61\2\2\u0179\u017a\7?\2\2\u017aT\3\2\2\2\u017b\u017c"+ 568 | "\7\'\2\2\u017c\u017d\7?\2\2\u017dV\3\2\2\2\u017e\u017f\7-\2\2\u017f\u0180"+ 569 | "\7?\2\2\u0180X\3\2\2\2\u0181\u0182\7/\2\2\u0182\u0183\7?\2\2\u0183Z\3"+ 570 | "\2\2\2\u0184\u0185\7>\2\2\u0185\u0186\7>\2\2\u0186\u0187\7?\2\2\u0187"+ 571 | "\\\3\2\2\2\u0188\u0189\7@\2\2\u0189\u018a\7@\2\2\u018a\u018b\7?\2\2\u018b"+ 572 | "^\3\2\2\2\u018c\u018d\7@\2\2\u018d\u018e\7@\2\2\u018e\u018f\7@\2\2\u018f"+ 573 | "\u0190\7?\2\2\u0190`\3\2\2\2\u0191\u0192\7(\2\2\u0192\u0193\7?\2\2\u0193"+ 574 | "b\3\2\2\2\u0194\u0195\7`\2\2\u0195\u0196\7?\2\2\u0196d\3\2\2\2\u0197\u0198"+ 575 | "\7~\2\2\u0198\u0199\7?\2\2\u0199f\3\2\2\2\u019a\u019b\7p\2\2\u019b\u019c"+ 576 | "\7w\2\2\u019c\u019d\7n\2\2\u019d\u019e\7n\2\2\u019eh\3\2\2\2\u019f\u01a0"+ 577 | "\7v\2\2\u01a0\u01a1\7t\2\2\u01a1\u01a2\7w\2\2\u01a2\u01a9\7g\2\2\u01a3"+ 578 | "\u01a4\7h\2\2\u01a4\u01a5\7c\2\2\u01a5\u01a6\7n\2\2\u01a6\u01a7\7u\2\2"+ 579 | "\u01a7\u01a9\7g\2\2\u01a8\u019f\3\2\2\2\u01a8\u01a3\3\2\2\2\u01a9j\3\2"+ 580 | "\2\2\u01aa\u01ab\5\u00edw\2\u01ab\u01af\7\60\2\2\u01ac\u01ae\5\u00e7t"+ 581 | "\2\u01ad\u01ac\3\2\2\2\u01ae\u01b1\3\2\2\2\u01af\u01ad\3\2\2\2\u01af\u01b0"+ 582 | "\3\2\2\2\u01b0\u01b3\3\2\2\2\u01b1\u01af\3\2\2\2\u01b2\u01b4\5\u00efx"+ 583 | "\2\u01b3\u01b2\3\2\2\2\u01b3\u01b4\3\2\2\2\u01b4\u01c3\3\2\2\2\u01b5\u01b7"+ 584 | "\7\60\2\2\u01b6\u01b8\5\u00e7t\2\u01b7\u01b6\3\2\2\2\u01b8\u01b9\3\2\2"+ 585 | "\2\u01b9\u01b7\3\2\2\2\u01b9\u01ba\3\2\2\2\u01ba\u01bc\3\2\2\2\u01bb\u01bd"+ 586 | "\5\u00efx\2\u01bc\u01bb\3\2\2\2\u01bc\u01bd\3\2\2\2\u01bd\u01c3\3\2\2"+ 587 | "\2\u01be\u01c0\5\u00edw\2\u01bf\u01c1\5\u00efx\2\u01c0\u01bf\3\2\2\2\u01c0"+ 588 | "\u01c1\3\2\2\2\u01c1\u01c3\3\2\2\2\u01c2\u01aa\3\2\2\2\u01c2\u01b5\3\2"+ 589 | "\2\2\u01c2\u01be\3\2\2\2\u01c3l\3\2\2\2\u01c4\u01c5\7\62\2\2\u01c5\u01c7"+ 590 | "\t\3\2\2\u01c6\u01c8\5\u00e9u\2\u01c7\u01c6\3\2\2\2\u01c8\u01c9\3\2\2"+ 591 | "\2\u01c9\u01c7\3\2\2\2\u01c9\u01ca\3\2\2\2\u01can\3\2\2\2\u01cb\u01cc"+ 592 | "\68\3\2\u01cc\u01ce\7\62\2\2\u01cd\u01cf\5\u00ebv\2\u01ce\u01cd\3\2\2"+ 593 | "\2\u01cf\u01d0\3\2\2\2\u01d0\u01ce\3\2\2\2\u01d0\u01d1\3\2\2\2\u01d1p"+ 594 | "\3\2\2\2\u01d2\u01d3\7d\2\2\u01d3\u01d4\7t\2\2\u01d4\u01d5\7g\2\2\u01d5"+ 595 | "\u01d6\7c\2\2\u01d6\u01d7\7m\2\2\u01d7r\3\2\2\2\u01d8\u01d9\7f\2\2\u01d9"+ 596 | "\u01da\7q\2\2\u01dat\3\2\2\2\u01db\u01dc\7k\2\2\u01dc\u01dd\7p\2\2\u01dd"+ 597 | "\u01de\7u\2\2\u01de\u01df\7v\2\2\u01df\u01e0\7c\2\2\u01e0\u01e1\7p\2\2"+ 598 | "\u01e1\u01e2\7e\2\2\u01e2\u01e3\7g\2\2\u01e3\u01e4\7q\2\2\u01e4\u01e5"+ 599 | "\7h\2\2\u01e5v\3\2\2\2\u01e6\u01e7\7v\2\2\u01e7\u01e8\7{\2\2\u01e8\u01e9"+ 600 | "\7r\2\2\u01e9\u01ea\7g\2\2\u01ea\u01eb\7q\2\2\u01eb\u01ec\7h\2\2\u01ec"+ 601 | "x\3\2\2\2\u01ed\u01ee\7e\2\2\u01ee\u01ef\7c\2\2\u01ef\u01f0\7u\2\2\u01f0"+ 602 | "\u01f1\7g\2\2\u01f1z\3\2\2\2\u01f2\u01f3\7g\2\2\u01f3\u01f4\7n\2\2\u01f4"+ 603 | "\u01f5\7u\2\2\u01f5\u01f6\7g\2\2\u01f6|\3\2\2\2\u01f7\u01f8\7p\2\2\u01f8"+ 604 | "\u01f9\7g\2\2\u01f9\u01fa\7y\2\2\u01fa~\3\2\2\2\u01fb\u01fc\7x\2\2\u01fc"+ 605 | "\u01fd\7c\2\2\u01fd\u01fe\7t\2\2\u01fe\u0080\3\2\2\2\u01ff\u0200\7e\2"+ 606 | "\2\u0200\u0201\7c\2\2\u0201\u0202\7v\2\2\u0202\u0203\7e\2\2\u0203\u0204"+ 607 | "\7j\2\2\u0204\u0082\3\2\2\2\u0205\u0206\7h\2\2\u0206\u0207\7k\2\2\u0207"+ 608 | "\u0208\7p\2\2\u0208\u0209\7c\2\2\u0209\u020a\7n\2\2\u020a\u020b\7n\2\2"+ 609 | "\u020b\u020c\7{\2\2\u020c\u0084\3\2\2\2\u020d\u020e\7t\2\2\u020e\u020f"+ 610 | "\7g\2\2\u020f\u0210\7v\2\2\u0210\u0211\7w\2\2\u0211\u0212\7t\2\2\u0212"+ 611 | "\u0213\7p\2\2\u0213\u0086\3\2\2\2\u0214\u0215\7x\2\2\u0215\u0216\7q\2"+ 612 | "\2\u0216\u0217\7k\2\2\u0217\u0218\7f\2\2\u0218\u0088\3\2\2\2\u0219\u021a"+ 613 | "\7e\2\2\u021a\u021b\7q\2\2\u021b\u021c\7p\2\2\u021c\u021d\7v\2\2\u021d"+ 614 | "\u021e\7k\2\2\u021e\u021f\7p\2\2\u021f\u0220\7w\2\2\u0220\u0221\7g\2\2"+ 615 | "\u0221\u008a\3\2\2\2\u0222\u0223\7h\2\2\u0223\u0224\7q\2\2\u0224\u0225"+ 616 | "\7t\2\2\u0225\u008c\3\2\2\2\u0226\u0227\7u\2\2\u0227\u0228\7y\2\2\u0228"+ 617 | "\u0229\7k\2\2\u0229\u022a\7v\2\2\u022a\u022b\7e\2\2\u022b\u022c\7j\2\2"+ 618 | "\u022c\u008e\3\2\2\2\u022d\u022e\7y\2\2\u022e\u022f\7j\2\2\u022f\u0230"+ 619 | "\7k\2\2\u0230\u0231\7n\2\2\u0231\u0232\7g\2\2\u0232\u0090\3\2\2\2\u0233"+ 620 | "\u0234\7f\2\2\u0234\u0235\7g\2\2\u0235\u0236\7d\2\2\u0236\u0237\7w\2\2"+ 621 | "\u0237\u0238\7i\2\2\u0238\u0239\7i\2\2\u0239\u023a\7g\2\2\u023a\u023b"+ 622 | "\7t\2\2\u023b\u0092\3\2\2\2\u023c\u023d\7h\2\2\u023d\u023e\7w\2\2\u023e"+ 623 | "\u023f\7p\2\2\u023f\u0240\7e\2\2\u0240\u0241\7v\2\2\u0241\u0242\7k\2\2"+ 624 | "\u0242\u0243\7q\2\2\u0243\u0244\7p\2\2\u0244\u0094\3\2\2\2\u0245\u0246"+ 625 | "\7v\2\2\u0246\u0247\7j\2\2\u0247\u0248\7k\2\2\u0248\u0249\7u\2\2\u0249"+ 626 | "\u0096\3\2\2\2\u024a\u024b\7y\2\2\u024b\u024c\7k\2\2\u024c\u024d\7v\2"+ 627 | "\2\u024d\u024e\7j\2\2\u024e\u0098\3\2\2\2\u024f\u0250\7f\2\2\u0250\u0251"+ 628 | "\7g\2\2\u0251\u0252\7h\2\2\u0252\u0253\7c\2\2\u0253\u0254\7w\2\2\u0254"+ 629 | "\u0255\7n\2\2\u0255\u0256\7v\2\2\u0256\u009a\3\2\2\2\u0257\u0258\7k\2"+ 630 | "\2\u0258\u0259\7h\2\2\u0259\u009c\3\2\2\2\u025a\u025b\7v\2\2\u025b\u025c"+ 631 | "\7j\2\2\u025c\u025d\7t\2\2\u025d\u025e\7q\2\2\u025e\u025f\7y\2\2\u025f"+ 632 | "\u009e\3\2\2\2\u0260\u0261\7f\2\2\u0261\u0262\7g\2\2\u0262\u0263\7n\2"+ 633 | "\2\u0263\u0264\7g\2\2\u0264\u0265\7v\2\2\u0265\u0266\7g\2\2\u0266\u00a0"+ 634 | "\3\2\2\2\u0267\u0268\7k\2\2\u0268\u0269\7p\2\2\u0269\u00a2\3\2\2\2\u026a"+ 635 | "\u026b\7v\2\2\u026b\u026c\7t\2\2\u026c\u026d\7{\2\2\u026d\u00a4\3\2\2"+ 636 | "\2\u026e\u026f\7e\2\2\u026f\u0270\7n\2\2\u0270\u0271\7c\2\2\u0271\u0272"+ 637 | "\7u\2\2\u0272\u0273\7u\2\2\u0273\u00a6\3\2\2\2\u0274\u0275\7g\2\2\u0275"+ 638 | "\u0276\7p\2\2\u0276\u0277\7w\2\2\u0277\u0278\7o\2\2\u0278\u00a8\3\2\2"+ 639 | "\2\u0279\u027a\7g\2\2\u027a\u027b\7z\2\2\u027b\u027c\7v\2\2\u027c\u027d"+ 640 | "\7g\2\2\u027d\u027e\7p\2\2\u027e\u027f\7f\2\2\u027f\u0280\7u\2\2\u0280"+ 641 | "\u00aa\3\2\2\2\u0281\u0282\7u\2\2\u0282\u0283\7w\2\2\u0283\u0284\7r\2"+ 642 | "\2\u0284\u0285\7g\2\2\u0285\u0286\7t\2\2\u0286\u00ac\3\2\2\2\u0287\u0288"+ 643 | "\7e\2\2\u0288\u0289\7q\2\2\u0289\u028a\7p\2\2\u028a\u028b\7u\2\2\u028b"+ 644 | "\u028c\7v\2\2\u028c\u00ae\3\2\2\2\u028d\u028e\7g\2\2\u028e\u028f\7z\2"+ 645 | "\2\u028f\u0290\7r\2\2\u0290\u0291\7q\2\2\u0291\u0292\7t\2\2\u0292\u0293"+ 646 | "\7v\2\2\u0293\u00b0\3\2\2\2\u0294\u0295\7k\2\2\u0295\u0296\7o\2\2\u0296"+ 647 | "\u0297\7r\2\2\u0297\u0298\7q\2\2\u0298\u0299\7t\2\2\u0299\u029a\7v\2\2"+ 648 | "\u029a\u00b2\3\2\2\2\u029b\u029c\6Z\4\2\u029c\u029d\7k\2\2\u029d\u029e"+ 649 | "\7o\2\2\u029e\u029f\7r\2\2\u029f\u02a0\7n\2\2\u02a0\u02a1\7g\2\2\u02a1"+ 650 | "\u02a2\7o\2\2\u02a2\u02a3\7g\2\2\u02a3\u02a4\7p\2\2\u02a4\u02a5\7v\2\2"+ 651 | "\u02a5\u02a6\7u\2\2\u02a6\u00b4\3\2\2\2\u02a7\u02a8\6[\5\2\u02a8\u02a9"+ 652 | "\7n\2\2\u02a9\u02aa\7g\2\2\u02aa\u02ab\7v\2\2\u02ab\u00b6\3\2\2\2\u02ac"+ 653 | "\u02ad\6\\\6\2\u02ad\u02ae\7r\2\2\u02ae\u02af\7t\2\2\u02af\u02b0\7k\2"+ 654 | "\2\u02b0\u02b1\7x\2\2\u02b1\u02b2\7c\2\2\u02b2\u02b3\7v\2\2\u02b3\u02b4"+ 655 | "\7g\2\2\u02b4\u00b8\3\2\2\2\u02b5\u02b6\6]\7\2\u02b6\u02b7\7r\2\2\u02b7"+ 656 | "\u02b8\7w\2\2\u02b8\u02b9\7d\2\2\u02b9\u02ba\7n\2\2\u02ba\u02bb\7k\2\2"+ 657 | "\u02bb\u02bc\7e\2\2\u02bc\u00ba\3\2\2\2\u02bd\u02be\6^\b\2\u02be\u02bf"+ 658 | "\7k\2\2\u02bf\u02c0\7p\2\2\u02c0\u02c1\7v\2\2\u02c1\u02c2\7g\2\2\u02c2"+ 659 | "\u02c3\7t\2\2\u02c3\u02c4\7h\2\2\u02c4\u02c5\7c\2\2\u02c5\u02c6\7e\2\2"+ 660 | "\u02c6\u02c7\7g\2\2\u02c7\u00bc\3\2\2\2\u02c8\u02c9\6_\t\2\u02c9\u02ca"+ 661 | "\7r\2\2\u02ca\u02cb\7c\2\2\u02cb\u02cc\7e\2\2\u02cc\u02cd\7m\2\2\u02cd"+ 662 | "\u02ce\7c\2\2\u02ce\u02cf\7i\2\2\u02cf\u02d0\7g\2\2\u02d0\u00be\3\2\2"+ 663 | "\2\u02d1\u02d2\6`\n\2\u02d2\u02d3\7r\2\2\u02d3\u02d4\7t\2\2\u02d4\u02d5"+ 664 | "\7q\2\2\u02d5\u02d6\7v\2\2\u02d6\u02d7\7g\2\2\u02d7\u02d8\7e\2\2\u02d8"+ 665 | "\u02d9\7v\2\2\u02d9\u02da\7g\2\2\u02da\u02db\7f\2\2\u02db\u00c0\3\2\2"+ 666 | "\2\u02dc\u02dd\6a\13\2\u02dd\u02de\7u\2\2\u02de\u02df\7v\2\2\u02df\u02e0"+ 667 | "\7c\2\2\u02e0\u02e1\7v\2\2\u02e1\u02e2\7k\2\2\u02e2\u02e3\7e\2\2\u02e3"+ 668 | "\u00c2\3\2\2\2\u02e4\u02e5\6b\f\2\u02e5\u02e6\7{\2\2\u02e6\u02e7\7k\2"+ 669 | "\2\u02e7\u02e8\7g\2\2\u02e8\u02e9\7n\2\2\u02e9\u02ea\7f\2\2\u02ea\u00c4"+ 670 | "\3\2\2\2\u02eb\u02ef\5\u00f1y\2\u02ec\u02ee\5\u00f3z\2\u02ed\u02ec\3\2"+ 671 | "\2\2\u02ee\u02f1\3\2\2\2\u02ef\u02ed\3\2\2\2\u02ef\u02f0\3\2\2\2\u02f0"+ 672 | "\u00c6\3\2\2\2\u02f1\u02ef\3\2\2\2\u02f2\u02f6\7$\2\2\u02f3\u02f5\5\u00d1"+ 673 | "i\2\u02f4\u02f3\3\2\2\2\u02f5\u02f8\3\2\2\2\u02f6\u02f4\3\2\2\2\u02f6"+ 674 | "\u02f7\3\2\2\2\u02f7\u02f9\3\2\2\2\u02f8\u02f6\3\2\2\2\u02f9\u0303\7$"+ 675 | "\2\2\u02fa\u02fe\7)\2\2\u02fb\u02fd\5\u00d3j\2\u02fc\u02fb\3\2\2\2\u02fd"+ 676 | "\u0300\3\2\2\2\u02fe\u02fc\3\2\2\2\u02fe\u02ff\3\2\2\2\u02ff\u0301\3\2"+ 677 | "\2\2\u0300\u02fe\3\2\2\2\u0301\u0303\7)\2\2\u0302\u02f2\3\2\2\2\u0302"+ 678 | "\u02fa\3\2\2\2\u0303\u00c8\3\2\2\2\u0304\u0306\t\4\2\2\u0305\u0304\3\2"+ 679 | "\2\2\u0306\u0307\3\2\2\2\u0307\u0305\3\2\2\2\u0307\u0308\3\2\2\2\u0308"+ 680 | "\u0309\3\2\2\2\u0309\u030a\be\2\2\u030a\u00ca\3\2\2\2\u030b\u030c\7\61"+ 681 | "\2\2\u030c\u030d\7,\2\2\u030d\u0311\3\2\2\2\u030e\u0310\13\2\2\2\u030f"+ 682 | "\u030e\3\2\2\2\u0310\u0313\3\2\2\2\u0311\u0312\3\2\2\2\u0311\u030f\3\2"+ 683 | "\2\2\u0312\u0314\3\2\2\2\u0313\u0311\3\2\2\2\u0314\u0315\7,\2\2\u0315"+ 684 | "\u0316\7\61\2\2\u0316\u0317\3\2\2\2\u0317\u0318\bf\2\2\u0318\u00cc\3\2"+ 685 | "\2\2\u0319\u031a\7\61\2\2\u031a\u031b\7\61\2\2\u031b\u031f\3\2\2\2\u031c"+ 686 | "\u031e\n\2\2\2\u031d\u031c\3\2\2\2\u031e\u0321\3\2\2\2\u031f\u031d\3\2"+ 687 | "\2\2\u031f\u0320\3\2\2\2\u0320\u0322\3\2\2\2\u0321\u031f\3\2\2\2\u0322"+ 688 | "\u0323\bg\2\2\u0323\u00ce\3\2\2\2\u0324\u0325\13\2\2\2\u0325\u00d0\3\2"+ 689 | "\2\2\u0326\u032b\n\5\2\2\u0327\u0328\7^\2\2\u0328\u032b\5\u00d5k\2\u0329"+ 690 | "\u032b\5\u00e3r\2\u032a\u0326\3\2\2\2\u032a\u0327\3\2\2\2\u032a\u0329"+ 691 | "\3\2\2\2\u032b\u00d2\3\2\2\2\u032c\u0331\n\6\2\2\u032d\u032e\7^\2\2\u032e"+ 692 | "\u0331\5\u00d5k\2\u032f\u0331\5\u00e3r\2\u0330\u032c\3\2\2\2\u0330\u032d"+ 693 | "\3\2\2\2\u0330\u032f\3\2\2\2\u0331\u00d4\3\2\2\2\u0332\u0337\5\u00d7l"+ 694 | "\2\u0333\u0337\7\62\2\2\u0334\u0337\5\u00d9m\2\u0335\u0337\5\u00dbn\2"+ 695 | "\u0336\u0332\3\2\2\2\u0336\u0333\3\2\2\2\u0336\u0334\3\2\2\2\u0336\u0335"+ 696 | "\3\2\2\2\u0337\u00d6\3\2\2\2\u0338\u033b\5\u00ddo\2\u0339\u033b\5\u00df"+ 697 | "p\2\u033a\u0338\3\2\2\2\u033a\u0339\3\2\2\2\u033b\u00d8\3\2\2\2\u033c"+ 698 | "\u033d\7z\2\2\u033d\u033e\5\u00e9u\2\u033e\u033f\5\u00e9u\2\u033f\u00da"+ 699 | "\3\2\2\2\u0340\u0341\7w\2\2\u0341\u0342\5\u00e9u\2\u0342\u0343\5\u00e9"+ 700 | "u\2\u0343\u0344\5\u00e9u\2\u0344\u0345\5\u00e9u\2\u0345\u00dc\3\2\2\2"+ 701 | "\u0346\u0347\t\7\2\2\u0347\u00de\3\2\2\2\u0348\u0349\n\b\2\2\u0349\u00e0"+ 702 | "\3\2\2\2\u034a\u034e\5\u00ddo\2\u034b\u034e\5\u00e7t\2\u034c\u034e\t\t"+ 703 | "\2\2\u034d\u034a\3\2\2\2\u034d\u034b\3\2\2\2\u034d\u034c\3\2\2\2\u034e"+ 704 | "\u00e2\3\2\2\2\u034f\u0350\7^\2\2\u0350\u0351\5\u00e5s\2\u0351\u00e4\3"+ 705 | "\2\2\2\u0352\u0353\7\17\2\2\u0353\u0356\7\f\2\2\u0354\u0356\5\5\3\2\u0355"+ 706 | "\u0352\3\2\2\2\u0355\u0354\3\2\2\2\u0356\u00e6\3\2\2\2\u0357\u0358\t\n"+ 707 | "\2\2\u0358\u00e8\3\2\2\2\u0359\u035a\t\13\2\2\u035a\u00ea\3\2\2\2\u035b"+ 708 | "\u035c\t\f\2\2\u035c\u00ec\3\2\2\2\u035d\u0366\7\62\2\2\u035e\u0362\t"+ 709 | "\r\2\2\u035f\u0361\5\u00e7t\2\u0360\u035f\3\2\2\2\u0361\u0364\3\2\2\2"+ 710 | "\u0362\u0360\3\2\2\2\u0362\u0363\3\2\2\2\u0363\u0366\3\2\2\2\u0364\u0362"+ 711 | "\3\2\2\2\u0365\u035d\3\2\2\2\u0365\u035e\3\2\2\2\u0366\u00ee\3\2\2\2\u0367"+ 712 | "\u0369\t\16\2\2\u0368\u036a\t\17\2\2\u0369\u0368\3\2\2\2\u0369\u036a\3"+ 713 | "\2\2\2\u036a\u036c\3\2\2\2\u036b\u036d\5\u00e7t\2\u036c\u036b\3\2\2\2"+ 714 | "\u036d\u036e\3\2\2\2\u036e\u036c\3\2\2\2\u036e\u036f\3\2\2\2\u036f\u00f0"+ 715 | "\3\2\2\2\u0370\u0375\5\u00f5{\2\u0371\u0375\t\20\2\2\u0372\u0373\7^\2"+ 716 | "\2\u0373\u0375\5\u00dbn\2\u0374\u0370\3\2\2\2\u0374\u0371\3\2\2\2\u0374"+ 717 | "\u0372\3\2\2\2\u0375\u00f2\3\2\2\2\u0376\u037d\5\u00f1y\2\u0377\u037d"+ 718 | "\5\u00f7|\2\u0378\u037d\5\u00f9}\2\u0379\u037d\5\u00fb~\2\u037a\u037d"+ 719 | "\5\u00fd\177\2\u037b\u037d\5\u00ff\u0080\2\u037c\u0376\3\2\2\2\u037c\u0377"+ 720 | "\3\2\2\2\u037c\u0378\3\2\2\2\u037c\u0379\3\2\2\2\u037c\u037a\3\2\2\2\u037c"+ 721 | "\u037b\3\2\2\2\u037d\u00f4\3\2\2\2\u037e\u0380\t\21\2\2\u037f\u037e\3"+ 722 | "\2\2\2\u0380\u00f6\3\2\2\2\u0381\u0383\t\22\2\2\u0382\u0381\3\2\2\2\u0383"+ 723 | "\u00f8\3\2\2\2\u0384\u0386\t\23\2\2\u0385\u0384\3\2\2\2\u0386\u00fa\3"+ 724 | "\2\2\2\u0387\u0389\t\24\2\2\u0388\u0387\3\2\2\2\u0389\u00fc\3\2\2\2\u038a"+ 725 | "\u038b\7\u200e\2\2\u038b\u00fe\3\2\2\2\u038c\u038d\7\u200f\2\2\u038d\u0100"+ 726 | "\3\2\2\2\u038e\u0392\5\u0105\u0083\2\u038f\u0391\5\u0107\u0084\2\u0390"+ 727 | "\u038f\3\2\2\2\u0391\u0394\3\2\2\2\u0392\u0390\3\2\2\2\u0392\u0393\3\2"+ 728 | "\2\2\u0393\u0102\3\2\2\2\u0394\u0392\3\2\2\2\u0395\u0397\5\u00f3z\2\u0396"+ 729 | "\u0395\3\2\2\2\u0397\u039a\3\2\2\2\u0398\u0396\3\2\2\2\u0398\u0399\3\2"+ 730 | "\2\2\u0399\u0104\3\2\2\2\u039a\u0398\3\2\2\2\u039b\u039f\n\25\2\2\u039c"+ 731 | "\u039f\5\u010b\u0086\2\u039d\u039f\5\u010d\u0087\2\u039e\u039b\3\2\2\2"+ 732 | "\u039e\u039c\3\2\2\2\u039e\u039d\3\2\2\2\u039f\u0106\3\2\2\2\u03a0\u03a4"+ 733 | "\n\26\2\2\u03a1\u03a4\5\u010b\u0086\2\u03a2\u03a4\5\u010d\u0087\2\u03a3"+ 734 | "\u03a0\3\2\2\2\u03a3\u03a1\3\2\2\2\u03a3\u03a2\3\2\2\2\u03a4\u0108\3\2"+ 735 | "\2\2\u03a5\u03a6\n\2\2\2\u03a6\u010a\3\2\2\2\u03a7\u03a8\7^\2\2\u03a8"+ 736 | "\u03a9\5\u0109\u0085\2\u03a9\u010c\3\2\2\2\u03aa\u03ae\7]\2\2\u03ab\u03ad"+ 737 | "\5\u010f\u0088\2\u03ac\u03ab\3\2\2\2\u03ad\u03b0\3\2\2\2\u03ae\u03ac\3"+ 738 | "\2\2\2\u03ae\u03af\3\2\2\2\u03af\u03b1\3\2\2\2\u03b0\u03ae\3\2\2\2\u03b1"+ 739 | "\u03b2\7_\2\2\u03b2\u010e\3\2\2\2\u03b3\u03b6\n\27\2\2\u03b4\u03b6\5\u010b"+ 740 | "\u0086\2\u03b5\u03b3\3\2\2\2\u03b5\u03b4\3\2\2\2\u03b6\u0110\3\2\2\2)"+ 741 | "\2\u01a8\u01af\u01b3\u01b9\u01bc\u01c0\u01c2\u01c9\u01d0\u02ef\u02f6\u02fe"+ 742 | "\u0302\u0307\u0311\u031f\u032a\u0330\u0336\u033a\u034d\u0355\u0362\u0365"+ 743 | "\u0369\u036e\u0374\u037c\u037f\u0382\u0385\u0388\u0392\u0398\u039e\u03a3"+ 744 | "\u03ae\u03b5\3\2\3\2"; 745 | public static final ATN _ATN = 746 | new ATNDeserializer().deserialize(_serializedATN.toCharArray()); 747 | static { 748 | _decisionToDFA = new DFA[_ATN.getNumberOfDecisions()]; 749 | for (int i = 0; i < _ATN.getNumberOfDecisions(); i++) { 750 | _decisionToDFA[i] = new DFA(_ATN.getDecisionState(i), i); 751 | } 752 | } 753 | } --------------------------------------------------------------------------------