├── plugin ├── valaproject │ ├── src │ │ └── org │ │ │ └── carbonfx │ │ │ └── valaproject │ │ │ ├── ValaTemplate.vala │ │ │ ├── VapiTemplate.vapi │ │ │ ├── vala.png │ │ │ ├── vapi.png │ │ │ ├── editor-preferences.xml │ │ │ ├── ValaResolver.xml │ │ │ ├── VapiResolver.xml │ │ │ ├── ValaExample.vala │ │ │ ├── Bundle.properties │ │ │ ├── FontAndColors.xml │ │ │ ├── editor │ │ │ ├── ValaIndentTaskFactory.java │ │ │ └── ValaIndentTask.java │ │ │ ├── parser │ │ │ ├── ValaParserFactory.java │ │ │ ├── SyntaxErrorsHighlightingTaskFactory.java │ │ │ ├── SyntaxErrorsHighlightingTask.java │ │ │ └── ValaParser.java │ │ │ ├── lexer │ │ │ ├── ValaTokenId.java │ │ │ ├── ValaLexer.java │ │ │ ├── AntlrCharStream.java │ │ │ └── ValaLanguageHierarchy.java │ │ │ ├── ValaDataObject.java │ │ │ ├── VapiDataObject.java │ │ │ ├── options │ │ │ ├── CodeStyle.java │ │ │ └── FmtOptions.java │ │ │ └── layer.xml │ ├── release │ │ └── modules │ │ │ └── ext │ │ │ └── antlr-3.3-complete.jar │ ├── nbproject │ │ ├── project.properties │ │ ├── genfiles.properties │ │ ├── platform.properties │ │ ├── build-impl.xml │ │ └── project.xml │ ├── manifest.mf │ ├── build.xml │ └── license.txt ├── .gitignore └── vala-icon.xcf ├── antlr ├── TestParser │ ├── test.cmd │ ├── testparse.cmd │ ├── manifest.mf │ ├── test.sh │ ├── nbproject │ │ ├── genfiles.properties │ │ ├── project.xml │ │ ├── project.properties │ │ └── build-impl.xml │ ├── src │ │ └── Main.java │ └── build.xml ├── .gitignore ├── processTokens.sh └── Vala.g ├── thirdparty └── antlr-3.3-complete.jar ├── template ├── .gitignore ├── src │ └── template.vala └── cmakelists.txt └── README.md /plugin/valaproject/src/org/carbonfx/valaproject/ValaTemplate.vala: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | */ 4 | -------------------------------------------------------------------------------- /plugin/valaproject/src/org/carbonfx/valaproject/VapiTemplate.vapi: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | */ 4 | -------------------------------------------------------------------------------- /antlr/TestParser/test.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | for /R %%i in (*.vala) do call "%~dp0\testparse.cmd" "%%i" -------------------------------------------------------------------------------- /plugin/.gitignore: -------------------------------------------------------------------------------- 1 | /valaproject/nbproject/private 2 | /valaproject/build 3 | /valaproject/dist 4 | -------------------------------------------------------------------------------- /antlr/.gitignore: -------------------------------------------------------------------------------- 1 | /output 2 | /TestParser/nbproject/private 3 | /TestParser/build 4 | /TestParser/dist -------------------------------------------------------------------------------- /plugin/vala-icon.xcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/carbonfx/netbeans-valaproject/HEAD/plugin/vala-icon.xcf -------------------------------------------------------------------------------- /antlr/TestParser/testparse.cmd: -------------------------------------------------------------------------------- 1 | java -jar "%~dp0\dist\TestParser.jar" %1 2 | if NOT ERRORLEVEL 0 echo "---Failed---" %1 -------------------------------------------------------------------------------- /antlr/TestParser/manifest.mf: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | X-COMMENT: Main-Class will be added automatically by build 3 | 4 | -------------------------------------------------------------------------------- /thirdparty/antlr-3.3-complete.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/carbonfx/netbeans-valaproject/HEAD/thirdparty/antlr-3.3-complete.jar -------------------------------------------------------------------------------- /antlr/TestParser/test.sh: -------------------------------------------------------------------------------- 1 | 2 | for f in $(find $1 -iname "*.vala") 3 | do 4 | echo "Processing: $f" 5 | java -jar "dist/TestParser.jar" $f 6 | done -------------------------------------------------------------------------------- /plugin/valaproject/src/org/carbonfx/valaproject/vala.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/carbonfx/netbeans-valaproject/HEAD/plugin/valaproject/src/org/carbonfx/valaproject/vala.png -------------------------------------------------------------------------------- /plugin/valaproject/src/org/carbonfx/valaproject/vapi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/carbonfx/netbeans-valaproject/HEAD/plugin/valaproject/src/org/carbonfx/valaproject/vapi.png -------------------------------------------------------------------------------- /plugin/valaproject/release/modules/ext/antlr-3.3-complete.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/carbonfx/netbeans-valaproject/HEAD/plugin/valaproject/release/modules/ext/antlr-3.3-complete.jar -------------------------------------------------------------------------------- /template/.gitignore: -------------------------------------------------------------------------------- 1 | /bin 2 | /CMakeFiles 3 | /nbproject 4 | /makefile 5 | /Makefile 6 | /CMakeCache.txt 7 | /cmake_install.cmake 8 | /gen 9 | /Makefile-template.mk 10 | /.dep.inc -------------------------------------------------------------------------------- /antlr/processTokens.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | sort output/Vala.tokens | \ 4 | awk -F "=" '{print ("new ValaTokenId (ValaParser.tokenNames[ValaLexer." \ 5 | $1 "], \"\", ValaLexer." $1 "),");}' -------------------------------------------------------------------------------- /plugin/valaproject/nbproject/project.properties: -------------------------------------------------------------------------------- 1 | javac.source=1.6 2 | javac.compilerargs=-Xlint -Xlint:-serial 3 | license.file=license.txt 4 | nbm.homepage=http://www.carbonfx.org 5 | nbm.module.author=Carbon Foundation X 6 | keystore=/media/truecrypt1/carbonfx/.keystore 7 | nbm_alias=carbonfx -------------------------------------------------------------------------------- /plugin/valaproject/manifest.mf: -------------------------------------------------------------------------------- 1 | Manifest-Version: 0.1.2 2 | OpenIDE-Module: org.carbonfx.valaproject/0 3 | OpenIDE-Module-Layer: org/carbonfx/valaproject/layer.xml 4 | OpenIDE-Module-Localizing-Bundle: org/carbonfx/valaproject/Bundle.properties 5 | OpenIDE-Module-Specification-Version: 0.1.2 6 | 7 | -------------------------------------------------------------------------------- /plugin/valaproject/src/org/carbonfx/valaproject/editor-preferences.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /plugin/valaproject/src/org/carbonfx/valaproject/ValaResolver.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /plugin/valaproject/src/org/carbonfx/valaproject/VapiResolver.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /template/src/template.vala: -------------------------------------------------------------------------------- 1 | using GLib; 2 | 3 | class Sample : Object 4 | { 5 | void run () 6 | { 7 | stdout.printf ("Hello World\n"); 8 | } 9 | 10 | static int main (string[] args) 11 | { 12 | var sample = new Sample (); 13 | sample.run (); 14 | return 0; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /plugin/valaproject/src/org/carbonfx/valaproject/ValaExample.vala: -------------------------------------------------------------------------------- 1 | /* 2 | Hello world application 3 | */ 4 | 5 | // Single line comment 6 | 7 | using GLib; 8 | 9 | /** 10 | JavaDoc comment 11 | */ 12 | class Sample : Object 13 | { 14 | void run () 15 | { 16 | stdout.printf ("Hello World\n"); 17 | } 18 | 19 | static int main (string[] args) 20 | { 21 | var sample = new Sample (); 22 | sample.run (); 23 | #if 0 24 | bad_code; 25 | #else 26 | #endif 27 | 28 | return 0; 29 | } 30 | } -------------------------------------------------------------------------------- /plugin/valaproject/nbproject/genfiles.properties: -------------------------------------------------------------------------------- 1 | build.xml.data.CRC32=c520cef8 2 | build.xml.script.CRC32=951d0f65 3 | build.xml.stylesheet.CRC32=a56c6a5b@1.42.2 4 | # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. 5 | # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. 6 | nbproject/build-impl.xml.data.CRC32=c520cef8 7 | nbproject/build-impl.xml.script.CRC32=42d1e5fd 8 | nbproject/build-impl.xml.stylesheet.CRC32=238281d1@1.42.2 9 | -------------------------------------------------------------------------------- /antlr/TestParser/nbproject/genfiles.properties: -------------------------------------------------------------------------------- 1 | build.xml.data.CRC32=ef36c682 2 | build.xml.script.CRC32=bbca52aa 3 | build.xml.stylesheet.CRC32=28e38971@1.38.3.45 4 | # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. 5 | # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. 6 | nbproject/build-impl.xml.data.CRC32=ef36c682 7 | nbproject/build-impl.xml.script.CRC32=b067f964 8 | nbproject/build-impl.xml.stylesheet.CRC32=229523de@1.38.3.45 9 | -------------------------------------------------------------------------------- /plugin/valaproject/build.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Builds, tests, and runs the project org.carbonfx.valaproject. 7 | 8 | 9 | -------------------------------------------------------------------------------- /antlr/TestParser/nbproject/project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | org.netbeans.modules.java.j2seproject 4 | 5 | 6 | TestParser 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /template/cmakelists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 2.6) 2 | 3 | set (CMAKE_RUNTIME_OUTPUT_DIRECTORY "bin") 4 | 5 | list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/vala) 6 | find_package(Vala REQUIRED) 7 | include(ValaPrecompile) 8 | include(ValaVersion) 9 | ensure_vala_version("0.11.0" MINIMUM) 10 | 11 | project (template C) 12 | 13 | find_package(PkgConfig) 14 | 15 | pkg_check_modules(GOBJECT REQUIRED gobject-2.0) 16 | add_definitions(${GOBJECT_CFLAGS} ${GOBJECT_CFLAGS_OTHER}) 17 | link_libraries(${GOBJECT_LIBRARIES}) 18 | link_directories(${GOBJECT_LIBRARY_DIRS}) 19 | 20 | 21 | vala_precompile(VALA_C 22 | src/template.vala 23 | PACKAGES 24 | OPTIONS 25 | --thread 26 | CUSTOM_VAPIS 27 | GENERATE_VAPI 28 | GENERATE_HEADER 29 | DIRECTORY 30 | gen 31 | ) 32 | 33 | add_executable("template" ${VALA_C}) 34 | -------------------------------------------------------------------------------- /plugin/valaproject/src/org/carbonfx/valaproject/Bundle.properties: -------------------------------------------------------------------------------- 1 | LBL_Vala_loader_name=Vala Files 2 | LBL_Vapi_loader_name=Vala API Files 3 | OpenIDE-Module-Display-Category=C/C++ 4 | OpenIDE-Module-Name=Vala Project 5 | OpenIDE-Module-Short-Description=Vala Project Support 6 | Services/MIMEResolver/ValaResolver.xml=Vala Files 7 | Services/MIMEResolver/VapiResolver.xml=Vala API Files 8 | Templates/Vala=Vala 9 | Templates/Vala/ValaTemplate.vala=Vala Source File 10 | Templates/Vala/VapiTemplate.vapi=Vala API Source File 11 | text/x-vala=Vala 12 | text/x-vapi=Vala API 13 | character=Character 14 | error=Error 15 | identifier=Identifier 16 | keyword=Keyword 17 | comment=Comment 18 | javadoc=JavaDoc Comment 19 | number=Number 20 | operator=Operator 21 | string=String 22 | separator=Separator 23 | whitespace=Whitespace 24 | method=Method 25 | regex=Regular Expression 26 | command=Command 27 | -------------------------------------------------------------------------------- /plugin/valaproject/nbproject/platform.properties: -------------------------------------------------------------------------------- 1 | cluster.path=\ 2 | ${nbplatform.active.dir}/apisupport:\ 3 | ${nbplatform.active.dir}/cnd:\ 4 | ${nbplatform.active.dir}/dlight:\ 5 | ${nbplatform.active.dir}/enterprise:\ 6 | ${nbplatform.active.dir}/ergonomics:\ 7 | ${nbplatform.active.dir}/groovy:\ 8 | ${nbplatform.active.dir}/harness:\ 9 | ${nbplatform.active.dir}/ide:\ 10 | ${nbplatform.active.dir}/identity:\ 11 | ${nbplatform.active.dir}/java:\ 12 | ${nbplatform.active.dir}/javacard:\ 13 | ${nbplatform.active.dir}/javafx:\ 14 | ${nbplatform.active.dir}/mobility:\ 15 | ${nbplatform.active.dir}/nb:\ 16 | ${nbplatform.active.dir}/php:\ 17 | ${nbplatform.active.dir}/platform:\ 18 | ${nbplatform.active.dir}/profiler:\ 19 | ${nbplatform.active.dir}/ruby:\ 20 | ${nbplatform.active.dir}/websvccommon 21 | nbplatform.active=default 22 | -------------------------------------------------------------------------------- /plugin/valaproject/src/org/carbonfx/valaproject/FontAndColors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /plugin/valaproject/license.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2011 Carbon Foundation X. All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are met: 5 | * Redistributions of source code must retain the above copyright 6 | notice, this list of conditions and the following disclaimer. 7 | * Redistributions in binary form must reproduce the above copyright 8 | notice, this list of conditions and the following disclaimer in the 9 | documentation and/or other materials provided with the distribution. 10 | * Neither the name of the Carbon Foundation X nor the 11 | names of its contributors may be used to endorse or promote products 12 | derived from this software without specific prior written permission. 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | DISCLAIMED. IN NO EVENT SHALL Carbon Foundation X BE LIABLE FOR ANY 18 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 21 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [CarbonFX](http://carbonfx.org) ValaProject - Plugin for the Netbeans IDE for Vala 2 | =============================================================================== 3 | 4 | This is a try to create plugin for Netbeans IDE to support comfortable Vala programming 5 | [Vala](http://live.gnome.org/Vala) is a new and modern programming language based on GObject type system. 6 | 7 | Feautures 8 | ------------------------------------------------------------------------------- 9 | 10 | At this moment, we have implemented: 11 | 12 | * Syntax coloring; 13 | * Tabs and code indents; 14 | * Syntax error highlight. 15 | 16 | Also there is a project template based on CMake. 17 | Using this template you can build and run Vala based project from the Netbeans IDE. 18 | 19 | Project template is based on 20 | [CMake for Vala](http://westhoffswelt.de/blog/0043_build_vala_projects_with_cmake_macros.html) 21 | 22 | Development 23 | ------------------------------------------------------------------------------- 24 | 25 | The next tasks are: 26 | * Sample projects for application and library within a plugin; 27 | * Code completion and hints; 28 | * Improve project support (class view, hide generated files and folders); 29 | * Debugging from the IDE. 30 | 31 | The plugin parser is based uppon ANTLR rules, see in antlr/Vala.g file. 32 | If you want to support or contribute into the project please feel free to contact us. 33 | 34 | Download and Install 35 | ------------------------------------------------------------------------------- 36 | 37 | Download plugin for Netbeans from [download section](netbeans-valaproject/downloads). 38 | To use a template project, copy it from the sources (git clone the project, and then copy template folder) 39 | 40 | Acknowledgment and License 41 | ------------------------------------------------------------------------------- 42 | 43 | The project is developed by Carbon Foundation X team with the support from [Innova Systems RU](http://www.inn.ru/). 44 | Source code and binaries are distributed under BSD 3-clause license ("New BSD License" or "Modified BSD License"). 45 | -------------------------------------------------------------------------------- /plugin/valaproject/src/org/carbonfx/valaproject/editor/ValaIndentTaskFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * CarbonFX ValaProject is a plugin for Netbeans IDE for Vala. 3 | * 4 | * Copyright (c) 2011 Carbon Foundation X. All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are met: 8 | * * Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * * Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * * Neither the name of the Carbon Foundation X nor the 14 | * names of its contributors may be used to endorse or promote products 15 | * derived from this software without specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 19 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | * DISCLAIMED. IN NO EVENT SHALL Carbon Foundation X BE LIABLE FOR ANY 21 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 24 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 | * 27 | */ 28 | package org.carbonfx.valaproject.editor; 29 | 30 | import org.netbeans.modules.editor.indent.spi.Context; 31 | import org.netbeans.modules.editor.indent.spi.IndentTask; 32 | 33 | public class ValaIndentTaskFactory implements IndentTask.Factory { 34 | 35 | @Override 36 | public IndentTask createTask(Context cntxt) { 37 | return new ValaIndentTask(cntxt); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /plugin/valaproject/nbproject/build-impl.xml: -------------------------------------------------------------------------------- 1 | 2 | 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 | -------------------------------------------------------------------------------- /plugin/valaproject/src/org/carbonfx/valaproject/parser/ValaParserFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * CarbonFX ValaProject is a plugin for Netbeans IDE for Vala. 3 | * 4 | * Copyright (c) 2011 Carbon Foundation X. All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are met: 8 | * * Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * * Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * * Neither the name of the Carbon Foundation X nor the 14 | * names of its contributors may be used to endorse or promote products 15 | * derived from this software without specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 19 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | * DISCLAIMED. IN NO EVENT SHALL Carbon Foundation X BE LIABLE FOR ANY 21 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 24 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 | * 27 | */ 28 | package org.carbonfx.valaproject.parser; 29 | 30 | import java.util.Collection; 31 | import org.netbeans.modules.parsing.api.Snapshot; 32 | import org.netbeans.modules.parsing.spi.Parser; 33 | import org.netbeans.modules.parsing.spi.ParserFactory; 34 | 35 | public class ValaParserFactory extends ParserFactory { 36 | 37 | @Override 38 | public Parser createParser(Collection clctn) { 39 | return new ValaParser(); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /plugin/valaproject/src/org/carbonfx/valaproject/parser/SyntaxErrorsHighlightingTaskFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * CarbonFX ValaProject is a plugin for Netbeans IDE for Vala. 3 | * 4 | * Copyright (c) 2011 Carbon Foundation X. All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are met: 8 | * * Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * * Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * * Neither the name of the Carbon Foundation X nor the 14 | * names of its contributors may be used to endorse or promote products 15 | * derived from this software without specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 19 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | * DISCLAIMED. IN NO EVENT SHALL Carbon Foundation X BE LIABLE FOR ANY 21 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 24 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 | * 27 | */ 28 | package org.carbonfx.valaproject.parser; 29 | 30 | import java.util.Collection; 31 | import java.util.Collections; 32 | import org.netbeans.modules.parsing.api.Snapshot; 33 | import org.netbeans.modules.parsing.spi.SchedulerTask; 34 | import org.netbeans.modules.parsing.spi.TaskFactory; 35 | 36 | public class SyntaxErrorsHighlightingTaskFactory extends TaskFactory { 37 | 38 | @Override 39 | public Collection create(Snapshot snpsht) { 40 | return Collections.singleton(new SyntaxErrorsHighlightingTask()); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /plugin/valaproject/src/org/carbonfx/valaproject/lexer/ValaTokenId.java: -------------------------------------------------------------------------------- 1 | /* 2 | * CarbonFX ValaProject is a plugin for Netbeans IDE for Vala. 3 | * 4 | * Copyright (c) 2011 Carbon Foundation X. All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are met: 8 | * * Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * * Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * * Neither the name of the Carbon Foundation X nor the 14 | * names of its contributors may be used to endorse or promote products 15 | * derived from this software without specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 19 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | * DISCLAIMED. IN NO EVENT SHALL Carbon Foundation X BE LIABLE FOR ANY 21 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 24 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 | * 27 | */ 28 | package org.carbonfx.valaproject.lexer; 29 | 30 | import org.netbeans.api.lexer.Language; 31 | import org.netbeans.api.lexer.TokenId; 32 | 33 | public class ValaTokenId implements TokenId { 34 | 35 | private final String name; 36 | private final String primaryCategory; 37 | private final int id; 38 | private static final Language language = new ValaLanguageHierarchy().language(); 39 | 40 | ValaTokenId( 41 | String name, 42 | String primaryCategory, 43 | int id) { 44 | this.name = name; 45 | this.primaryCategory = primaryCategory; 46 | this.id = id; 47 | } 48 | 49 | @Override 50 | public String name() { 51 | return name; 52 | } 53 | 54 | @Override 55 | public int ordinal() { 56 | return id; 57 | } 58 | 59 | @Override 60 | public String primaryCategory() { 61 | return primaryCategory; 62 | } 63 | 64 | public static Language getLanguage() { 65 | return language; 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /antlr/TestParser/src/Main.java: -------------------------------------------------------------------------------- 1 | /* 2 | * CarbonFX ValaProject is a plugin for Netbeans IDE for Vala. 3 | * 4 | * Copyright (c) 2011 Carbon Foundation X. All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are met: 8 | * * Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * * Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * * Neither the name of the Carbon Foundation X nor the 14 | * names of its contributors may be used to endorse or promote products 15 | * derived from this software without specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 19 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | * DISCLAIMED. IN NO EVENT SHALL Carbon Foundation X BE LIABLE FOR ANY 21 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 24 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 | * 27 | */ 28 | 29 | import org.antlr.runtime.*; 30 | import org.carbonfx.valaproject.antlr.ValaLexer; 31 | import org.carbonfx.valaproject.antlr.ValaParser; 32 | 33 | 34 | public class Main { 35 | 36 | public static void main(String args[]) throws Exception { 37 | 38 | String s = args[0]; 39 | 40 | ValaLexer lex = new ValaLexer(new ANTLRFileStream(s, "UTF8")); 41 | CommonTokenStream tokens = new CommonTokenStream(lex); 42 | 43 | ValaParser g = new ValaParser(tokens); 44 | int errorCode = 0; 45 | try { 46 | g.compilation_unit(); 47 | } catch (RecognitionException e) { 48 | //e.printStackTrace(); 49 | errorCode = 100; 50 | } 51 | catch (Throwable t) 52 | { 53 | //t.printStackTrace(); 54 | errorCode = 200; 55 | } 56 | 57 | if (g.getNumberOfSyntaxErrors() > 0) 58 | { 59 | errorCode = 300; 60 | } 61 | 62 | if (errorCode != 0) 63 | { 64 | System.out.println("Failed to parse: " + s); 65 | } 66 | 67 | System.exit(errorCode); 68 | } 69 | } -------------------------------------------------------------------------------- /antlr/TestParser/nbproject/project.properties: -------------------------------------------------------------------------------- 1 | annotation.processing.enabled=true 2 | annotation.processing.enabled.in.editor=false 3 | annotation.processing.run.all.processors=true 4 | annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output 5 | application.title=TestParser 6 | application.vendor=m.abdurakhmanov 7 | build.classes.dir=${build.dir}/classes 8 | build.classes.excludes=**/*.java,**/*.form 9 | # This directory is removed when the project is cleaned: 10 | build.dir=build 11 | build.generated.dir=${build.dir}/generated 12 | build.generated.sources.dir=${build.dir}/generated-sources 13 | # Only compile against the classpath explicitly listed here: 14 | build.sysclasspath=ignore 15 | build.test.classes.dir=${build.dir}/test/classes 16 | build.test.results.dir=${build.dir}/test/results 17 | # Uncomment to specify the preferred debugger connection transport: 18 | #debug.transport=dt_socket 19 | debug.classpath=\ 20 | ${run.classpath} 21 | debug.test.classpath=\ 22 | ${run.test.classpath} 23 | # This directory is removed when the project is cleaned: 24 | dist.dir=dist 25 | dist.jar=${dist.dir}/TestParser.jar 26 | dist.javadoc.dir=${dist.dir}/javadoc 27 | endorsed.classpath= 28 | excludes= 29 | file.reference.antlr-3.3-complete.jar=..\\..\\thirdparty\\antlr-3.3-complete.jar 30 | includes=** 31 | jar.compress=false 32 | javac.classpath=\ 33 | ${file.reference.antlr-3.3-complete.jar} 34 | # Space-separated list of extra javac options 35 | javac.compilerargs= 36 | javac.deprecation=false 37 | javac.processorpath=\ 38 | ${javac.classpath} 39 | javac.source=1.5 40 | javac.target=1.5 41 | javac.test.classpath=\ 42 | ${javac.classpath}:\ 43 | ${build.classes.dir}:\ 44 | ${libs.junit.classpath}:\ 45 | ${libs.junit_4.classpath} 46 | javac.test.processorpath=\ 47 | ${javac.test.classpath} 48 | javadoc.additionalparam= 49 | javadoc.author=false 50 | javadoc.encoding=${source.encoding} 51 | javadoc.noindex=false 52 | javadoc.nonavbar=false 53 | javadoc.notree=false 54 | javadoc.private=false 55 | javadoc.splitindex=true 56 | javadoc.use=true 57 | javadoc.version=false 58 | javadoc.windowtitle= 59 | main.class=Main 60 | manifest.file=manifest.mf 61 | meta.inf.dir=${src.dir}/META-INF 62 | platform.active=default_platform 63 | run.classpath=\ 64 | ${javac.classpath}:\ 65 | ${build.classes.dir} 66 | # Space-separated list of JVM arguments used when running the project 67 | # (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value 68 | # or test-sys-prop.name=value to set system properties for unit tests): 69 | run.jvmargs= 70 | run.test.classpath=\ 71 | ${javac.test.classpath}:\ 72 | ${build.test.classes.dir} 73 | source.encoding=UTF-8 74 | src.dir=src 75 | test.src.dir=test 76 | -------------------------------------------------------------------------------- /plugin/valaproject/src/org/carbonfx/valaproject/ValaDataObject.java: -------------------------------------------------------------------------------- 1 | /* 2 | * CarbonFX ValaProject is a plugin for Netbeans IDE for Vala. 3 | * 4 | * Copyright (c) 2011 Carbon Foundation X. All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are met: 8 | * * Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * * Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * * Neither the name of the Carbon Foundation X nor the 14 | * names of its contributors may be used to endorse or promote products 15 | * derived from this software without specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 19 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | * DISCLAIMED. IN NO EVENT SHALL Carbon Foundation X BE LIABLE FOR ANY 21 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 24 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 | * 27 | */ 28 | package org.carbonfx.valaproject; 29 | 30 | import java.io.IOException; 31 | import org.openide.filesystems.FileObject; 32 | import org.openide.loaders.DataNode; 33 | import org.openide.loaders.DataObjectExistsException; 34 | import org.openide.loaders.MultiDataObject; 35 | import org.openide.loaders.MultiFileLoader; 36 | import org.openide.nodes.CookieSet; 37 | import org.openide.nodes.Node; 38 | import org.openide.nodes.Children; 39 | import org.openide.util.Lookup; 40 | import org.openide.text.DataEditorSupport; 41 | 42 | public class ValaDataObject extends MultiDataObject { 43 | 44 | public ValaDataObject(FileObject pf, MultiFileLoader loader) throws DataObjectExistsException, IOException { 45 | super(pf, loader); 46 | CookieSet cookies = getCookieSet(); 47 | cookies.add((Node.Cookie) DataEditorSupport.create(this, getPrimaryEntry(), cookies)); 48 | } 49 | 50 | @Override 51 | protected Node createNodeDelegate() { 52 | return new DataNode(this, Children.LEAF, getLookup()); 53 | } 54 | 55 | @Override 56 | public Lookup getLookup() { 57 | return getCookieSet().getLookup(); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /plugin/valaproject/src/org/carbonfx/valaproject/VapiDataObject.java: -------------------------------------------------------------------------------- 1 | /* 2 | * CarbonFX ValaProject is a plugin for Netbeans IDE for Vala. 3 | * 4 | * Copyright (c) 2011 Carbon Foundation X. All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are met: 8 | * * Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * * Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * * Neither the name of the Carbon Foundation X nor the 14 | * names of its contributors may be used to endorse or promote products 15 | * derived from this software without specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 19 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | * DISCLAIMED. IN NO EVENT SHALL Carbon Foundation X BE LIABLE FOR ANY 21 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 24 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 | * 27 | */ 28 | package org.carbonfx.valaproject; 29 | 30 | import java.io.IOException; 31 | import org.openide.filesystems.FileObject; 32 | import org.openide.loaders.DataNode; 33 | import org.openide.loaders.DataObjectExistsException; 34 | import org.openide.loaders.MultiDataObject; 35 | import org.openide.loaders.MultiFileLoader; 36 | import org.openide.nodes.CookieSet; 37 | import org.openide.nodes.Node; 38 | import org.openide.nodes.Children; 39 | import org.openide.util.Lookup; 40 | import org.openide.text.DataEditorSupport; 41 | 42 | public class VapiDataObject extends MultiDataObject { 43 | 44 | public VapiDataObject(FileObject pf, MultiFileLoader loader) throws DataObjectExistsException, IOException { 45 | super(pf, loader); 46 | CookieSet cookies = getCookieSet(); 47 | cookies.add((Node.Cookie) DataEditorSupport.create(this, getPrimaryEntry(), cookies)); 48 | } 49 | 50 | @Override 51 | protected Node createNodeDelegate() { 52 | return new DataNode(this, Children.LEAF, getLookup()); 53 | } 54 | 55 | @Override 56 | public Lookup getLookup() { 57 | return getCookieSet().getLookup(); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /plugin/valaproject/src/org/carbonfx/valaproject/options/CodeStyle.java: -------------------------------------------------------------------------------- 1 | /* 2 | * CarbonFX ValaProject is a plugin for Netbeans IDE for Vala. 3 | * 4 | * Copyright (c) 2011 Carbon Foundation X. All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are met: 8 | * * Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * * Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * * Neither the name of the Carbon Foundation X nor the 14 | * names of its contributors may be used to endorse or promote products 15 | * derived from this software without specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 19 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | * DISCLAIMED. IN NO EVENT SHALL Carbon Foundation X BE LIABLE FOR ANY 21 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 24 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 | * 27 | */ 28 | package org.carbonfx.valaproject.options; 29 | 30 | import java.util.prefs.Preferences; 31 | 32 | import javax.swing.text.Document; 33 | import org.netbeans.modules.editor.indent.spi.CodeStylePreferences; 34 | import static org.carbonfx.valaproject.options.FmtOptions.*; 35 | 36 | public final class CodeStyle { 37 | 38 | private final Preferences preferences; 39 | 40 | public static CodeStyle getCodeStyle(Document document) { 41 | CodeStyle cs = new CodeStyle(CodeStylePreferences.get(document).getPreferences()); 42 | return cs; 43 | } 44 | 45 | private CodeStyle(Preferences preferences) { 46 | this.preferences = preferences; 47 | } 48 | 49 | public int getIndentSize() { 50 | return preferences.getInt(indentSize, getDefaultAsInt(indentSize)); 51 | } 52 | 53 | public int getTabSize() { 54 | return preferences.getInt(tabSize, getDefaultAsInt(tabSize)); 55 | } 56 | 57 | public boolean getExpandTabToSpaces() { 58 | return preferences.getBoolean(expandTabToSpaces, getDefaultAsBoolean(expandTabToSpaces)); 59 | } 60 | 61 | public int getRightMargin() { 62 | return preferences.getInt(rightMargin, getDefaultAsInt(rightMargin)); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /plugin/valaproject/src/org/carbonfx/valaproject/lexer/ValaLexer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * CarbonFX ValaProject is a plugin for Netbeans IDE for Vala. 3 | * 4 | * Copyright (c) 2011 Carbon Foundation X. All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are met: 8 | * * Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * * Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * * Neither the name of the Carbon Foundation X nor the 14 | * names of its contributors may be used to endorse or promote products 15 | * derived from this software without specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 19 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | * DISCLAIMED. IN NO EVENT SHALL Carbon Foundation X BE LIABLE FOR ANY 21 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 24 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 | * 27 | */ 28 | package org.carbonfx.valaproject.lexer; 29 | 30 | import org.netbeans.api.lexer.PartType; 31 | import org.netbeans.api.lexer.Token; 32 | import org.netbeans.spi.lexer.Lexer; 33 | import org.netbeans.spi.lexer.LexerRestartInfo; 34 | 35 | public class ValaLexer implements Lexer { 36 | 37 | private LexerRestartInfo info; 38 | private org.carbonfx.valaproject.antlr.ValaLexer lexer; 39 | 40 | public ValaLexer(LexerRestartInfo info) { 41 | 42 | this.info = info; 43 | AntlrCharStream charStream = new AntlrCharStream(info.input(), "Vala"); 44 | this.lexer = new org.carbonfx.valaproject.antlr.ValaLexer(charStream); 45 | } 46 | 47 | @Override 48 | public Token nextToken() { 49 | 50 | org.antlr.runtime.Token token = lexer.nextToken(); 51 | Token resultToken = null; 52 | 53 | if (token.getType() != org.carbonfx.valaproject.antlr.ValaLexer.EOF) { 54 | ValaTokenId tokenId = ValaLanguageHierarchy.getToken(token.getType()); 55 | resultToken = info.tokenFactory().createToken(tokenId); 56 | } else if (info.input().readLength() > 0) // incomplete token, return as a comment 57 | { 58 | ValaTokenId tokenId = ValaLanguageHierarchy.getToken(org.carbonfx.valaproject.antlr.ValaLexer.COMMENT); 59 | resultToken = info.tokenFactory().createToken(tokenId, info.input().readLength(), PartType.MIDDLE); 60 | } 61 | 62 | return resultToken; 63 | } 64 | 65 | @Override 66 | public Object state() { 67 | return null; 68 | } 69 | 70 | @Override 71 | public void release() { 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /plugin/valaproject/src/org/carbonfx/valaproject/options/FmtOptions.java: -------------------------------------------------------------------------------- 1 | /* 2 | * CarbonFX ValaProject is a plugin for Netbeans IDE for Vala. 3 | * 4 | * Copyright (c) 2011 Carbon Foundation X. All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are met: 8 | * * Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * * Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * * Neither the name of the Carbon Foundation X nor the 14 | * names of its contributors may be used to endorse or promote products 15 | * derived from this software without specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 19 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | * DISCLAIMED. IN NO EVENT SHALL Carbon Foundation X BE LIABLE FOR ANY 21 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 24 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 | * 27 | */ 28 | package org.carbonfx.valaproject.options; 29 | 30 | import java.util.HashMap; 31 | import java.util.Map; 32 | import org.netbeans.api.editor.settings.SimpleValueNames; 33 | 34 | public class FmtOptions { 35 | 36 | public static final String expandTabToSpaces = SimpleValueNames.EXPAND_TABS; 37 | public static final String tabSize = SimpleValueNames.TAB_SIZE; 38 | public static final String indentSize = SimpleValueNames.INDENT_SHIFT_WIDTH; 39 | //public static final String spacesPerTab = SimpleValueNames.SPACES_PER_TAB; 40 | public static final String rightMargin = SimpleValueNames.TEXT_LIMIT_WIDTH; 41 | 42 | private FmtOptions() { 43 | } 44 | 45 | public static int getDefaultAsInt(String key) { 46 | return Integer.parseInt(defaults.get(key)); 47 | } 48 | 49 | public static boolean getDefaultAsBoolean(String key) { 50 | return Boolean.parseBoolean(defaults.get(key)); 51 | } 52 | 53 | public static String getDefaultAsString(String key) { 54 | return defaults.get(key); 55 | } 56 | // Private section --------------------------------------------------------- 57 | private static final String TRUE = "true"; // NOI18N 58 | private static final String FALSE = "false"; // NOI18N 59 | private static Map defaults; 60 | 61 | static { 62 | createDefaults(); 63 | } 64 | 65 | private static void createDefaults() { 66 | String defaultValues[][] = { 67 | {expandTabToSpaces, TRUE}, //NOI18N 68 | {tabSize, "4"}, //NOI18N 69 | {indentSize, "4"}, //NOI18N 70 | {rightMargin, "80"}, //NOI18N 71 | }; 72 | 73 | defaults = new HashMap(); 74 | 75 | for (java.lang.String[] strings : defaultValues) { 76 | defaults.put(strings[0], strings[1]); 77 | } 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /antlr/TestParser/build.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | Builds, tests, and runs the project TestParser. 12 | 13 | 74 | 75 | -------------------------------------------------------------------------------- /plugin/valaproject/src/org/carbonfx/valaproject/parser/SyntaxErrorsHighlightingTask.java: -------------------------------------------------------------------------------- 1 | /* 2 | * CarbonFX ValaProject is a plugin for Netbeans IDE for Vala. 3 | * 4 | * Copyright (c) 2011 Carbon Foundation X. All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are met: 8 | * * Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * * Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * * Neither the name of the Carbon Foundation X nor the 14 | * names of its contributors may be used to endorse or promote products 15 | * derived from this software without specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 19 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | * DISCLAIMED. IN NO EVENT SHALL Carbon Foundation X BE LIABLE FOR ANY 21 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 24 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 | * 27 | */ 28 | package org.carbonfx.valaproject.parser; 29 | 30 | import java.util.ArrayList; 31 | import java.util.List; 32 | import javax.swing.text.Document; 33 | import org.carbonfx.valaproject.antlr.ValaParser.SyntaxError; 34 | import org.netbeans.modules.parsing.spi.Parser.Result; 35 | import org.netbeans.modules.parsing.spi.ParserResultTask; 36 | import org.netbeans.modules.parsing.spi.Scheduler; 37 | import org.netbeans.modules.parsing.spi.SchedulerEvent; 38 | import org.netbeans.spi.editor.hints.ErrorDescription; 39 | import org.netbeans.spi.editor.hints.ErrorDescriptionFactory; 40 | import org.netbeans.spi.editor.hints.HintsController; 41 | import org.netbeans.spi.editor.hints.Severity; 42 | 43 | public class SyntaxErrorsHighlightingTask extends ParserResultTask { 44 | 45 | public SyntaxErrorsHighlightingTask() { 46 | } 47 | 48 | //org.carbonfx.valaproject.antlr.ValaParser 49 | @Override 50 | public void run(Result result, SchedulerEvent se) { 51 | try { 52 | ValaParser.ValaParserResult r = (ValaParser.ValaParserResult) result; 53 | List syntaxErrors = r.getParser().syntaxErrors; 54 | Document document = result.getSnapshot().getSource().getDocument(false); 55 | 56 | List errors = new ArrayList(); 57 | 58 | for (SyntaxError syntaxError : syntaxErrors) { 59 | org.antlr.runtime.RecognitionException exception = syntaxError.exception; 60 | String message = syntaxError.message; 61 | 62 | int line = exception.line; 63 | if (line <= 0) { 64 | continue; 65 | } 66 | ErrorDescription errorDescription = ErrorDescriptionFactory.createErrorDescription( 67 | Severity.ERROR, 68 | message, 69 | document, 70 | line); 71 | errors.add(errorDescription); 72 | } 73 | 74 | HintsController.setErrors(document, "vala", errors); 75 | } catch (Exception ex) { 76 | ex.printStackTrace(); 77 | } 78 | } 79 | 80 | @Override 81 | public int getPriority() { 82 | return 100; 83 | } 84 | 85 | @Override 86 | public Class getSchedulerClass() { 87 | return Scheduler.EDITOR_SENSITIVE_TASK_SCHEDULER; 88 | } 89 | 90 | @Override 91 | public void cancel() { 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /plugin/valaproject/src/org/carbonfx/valaproject/parser/ValaParser.java: -------------------------------------------------------------------------------- 1 | /* 2 | * CarbonFX ValaProject is a plugin for Netbeans IDE for Vala. 3 | * 4 | * Copyright (c) 2011 Carbon Foundation X. All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are met: 8 | * * Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * * Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * * Neither the name of the Carbon Foundation X nor the 14 | * names of its contributors may be used to endorse or promote products 15 | * derived from this software without specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 19 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | * DISCLAIMED. IN NO EVENT SHALL Carbon Foundation X BE LIABLE FOR ANY 21 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 24 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 | * 27 | */ 28 | package org.carbonfx.valaproject.parser; 29 | 30 | import javax.swing.event.ChangeListener; 31 | import org.antlr.runtime.ANTLRStringStream; 32 | import org.antlr.runtime.CommonTokenStream; 33 | 34 | import org.netbeans.modules.parsing.api.Snapshot; 35 | import org.netbeans.modules.parsing.api.Task; 36 | import org.netbeans.modules.parsing.spi.ParseException; 37 | import org.netbeans.modules.parsing.spi.Parser; 38 | import org.netbeans.modules.parsing.spi.SourceModificationEvent; 39 | 40 | public class ValaParser extends Parser { 41 | 42 | private Snapshot snapshot; 43 | private org.carbonfx.valaproject.antlr.ValaParser parser; 44 | 45 | @Override 46 | public void parse(Snapshot snpsht, Task task, SourceModificationEvent sme) throws ParseException { 47 | 48 | this.snapshot = snpsht; 49 | ANTLRStringStream input = new ANTLRStringStream(snapshot.getText().toString()); 50 | org.antlr.runtime.Lexer lexer = new org.carbonfx.valaproject.antlr.ValaLexer(input); 51 | CommonTokenStream tokens = new CommonTokenStream(lexer); 52 | this.parser = new org.carbonfx.valaproject.antlr.ValaParser(tokens); 53 | try { 54 | this.parser.compilation_unit(); 55 | } catch (Exception ex) { 56 | ex.printStackTrace(); 57 | } 58 | } 59 | 60 | @Override 61 | public Result getResult(Task task) throws ParseException { 62 | return new ValaParserResult(this.snapshot, this.parser); 63 | } 64 | 65 | @Override 66 | public void cancel() { 67 | } 68 | 69 | @Override 70 | public void addChangeListener(ChangeListener cl) { 71 | } 72 | 73 | @Override 74 | public void removeChangeListener(ChangeListener cl) { 75 | } 76 | 77 | public static class ValaParserResult extends Result { 78 | 79 | private org.carbonfx.valaproject.antlr.ValaParser parser; 80 | private boolean valid = true; 81 | 82 | ValaParserResult(Snapshot snapshot, org.carbonfx.valaproject.antlr.ValaParser parser) { 83 | super(snapshot); 84 | this.parser = parser; 85 | } 86 | 87 | public org.carbonfx.valaproject.antlr.ValaParser getParser() 88 | throws ParseException { 89 | if (!valid) { 90 | throw new ParseException(); 91 | } 92 | return parser; 93 | } 94 | 95 | @Override 96 | protected void invalidate() { 97 | valid = false; 98 | } 99 | } 100 | } 101 | -------------------------------------------------------------------------------- /plugin/valaproject/src/org/carbonfx/valaproject/lexer/AntlrCharStream.java: -------------------------------------------------------------------------------- 1 | /* 2 | * CarbonFX ValaProject is a plugin for Netbeans IDE for Vala. 3 | * 4 | * Copyright (c) 2011 Carbon Foundation X. All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are met: 8 | * * Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * * Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * * Neither the name of the Carbon Foundation X nor the 14 | * names of its contributors may be used to endorse or promote products 15 | * derived from this software without specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 19 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | * DISCLAIMED. IN NO EVENT SHALL Carbon Foundation X BE LIABLE FOR ANY 21 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 24 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 | * 27 | */ 28 | package org.carbonfx.valaproject.lexer; 29 | 30 | import java.util.ArrayList; 31 | import java.util.List; 32 | import org.antlr.runtime.CharStream; 33 | import org.netbeans.spi.lexer.LexerInput; 34 | 35 | public class AntlrCharStream implements CharStream { 36 | 37 | private class CharStreamState { 38 | 39 | int index; 40 | int line; 41 | int charPositionInLine; 42 | } 43 | private int line = 1; 44 | private int charPositionInLine = 0; 45 | private LexerInput input; 46 | private String name; 47 | private int index = 0; 48 | private List markers; 49 | private int markDepth = 0; 50 | private int lastMarker; 51 | 52 | public AntlrCharStream(LexerInput input, String name) { 53 | this.input = input; 54 | this.name = name; 55 | } 56 | 57 | @Override 58 | public String substring(int start, int stop) { 59 | throw new UnsupportedOperationException("Not supported yet."); 60 | } 61 | 62 | @Override 63 | public int LT(int i) { 64 | return LA(i); 65 | } 66 | 67 | @Override 68 | public int getLine() { 69 | return line; 70 | } 71 | 72 | @Override 73 | public void setLine(int line) { 74 | this.line = line; 75 | } 76 | 77 | @Override 78 | public void setCharPositionInLine(int pos) { 79 | this.charPositionInLine = pos; 80 | } 81 | 82 | @Override 83 | public int getCharPositionInLine() { 84 | return charPositionInLine; 85 | } 86 | 87 | @Override 88 | public void consume() { 89 | int c = input.read(); 90 | index++; 91 | charPositionInLine++; 92 | 93 | if (c == '\n') { 94 | line++; 95 | charPositionInLine = 0; 96 | } 97 | } 98 | 99 | @Override 100 | public int LA(int i) { 101 | if (i == 0) { 102 | return 0; // undefined 103 | } 104 | 105 | int c = 0; 106 | for (int j = 0; j < i; j++) { 107 | c = read(); 108 | } 109 | backup(i); 110 | return c; 111 | } 112 | 113 | @Override 114 | public int mark() { 115 | if (markers == null) { 116 | markers = new ArrayList(); 117 | markers.add(null); // depth 0 means no backtracking, leave blank 118 | } 119 | markDepth++; 120 | CharStreamState state = null; 121 | if (markDepth >= markers.size()) { 122 | state = new CharStreamState(); 123 | markers.add(state); 124 | } else { 125 | state = markers.get(markDepth); 126 | } 127 | state.index = index; 128 | state.line = line; 129 | state.charPositionInLine = charPositionInLine; 130 | lastMarker = markDepth; 131 | 132 | return markDepth; 133 | } 134 | 135 | @Override 136 | public void rewind() { 137 | rewind(lastMarker); 138 | } 139 | 140 | @Override 141 | public void rewind(int marker) { 142 | CharStreamState state = markers.get(marker); 143 | // restore stream state 144 | seek(state.index); 145 | line = state.line; 146 | charPositionInLine = state.charPositionInLine; 147 | release(marker); 148 | } 149 | 150 | @Override 151 | public void release(int marker) { 152 | // unwind any other markers made after m and release m 153 | markDepth = marker; 154 | // release this marker 155 | markDepth--; 156 | } 157 | 158 | @Override 159 | public void seek(int index) { 160 | if (index < this.index) { 161 | backup(this.index - index); 162 | this.index = index; // just jump; don't update stream state (line, ...) 163 | return; 164 | } 165 | 166 | // seek forward, consume until p hits index 167 | while (this.index < index) { 168 | consume(); 169 | } 170 | } 171 | 172 | @Override 173 | public int index() { 174 | return index; 175 | } 176 | 177 | @Override 178 | public int size() { 179 | return -1; //unknown... 180 | } 181 | 182 | @Override 183 | public String getSourceName() { 184 | return name; 185 | } 186 | 187 | private int read() { 188 | int result = input.read(); 189 | if (result == LexerInput.EOF) { 190 | result = CharStream.EOF; 191 | } 192 | 193 | return result; 194 | } 195 | 196 | private void backup(int count) { 197 | input.backup(count); 198 | } 199 | } 200 | -------------------------------------------------------------------------------- /plugin/valaproject/nbproject/project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | org.netbeans.modules.apisupport.project 4 | 5 | 6 | org.carbonfx.valaproject 7 | 8 | 9 | 10 | org.netbeans.modules.editor.indent 11 | 12 | 13 | 14 | 2 15 | 1.19.1.10 16 | 17 | 18 | 19 | org.netbeans.modules.editor.lib 20 | 21 | 22 | 23 | 2 24 | 25 | 26 | 27 | org.netbeans.modules.editor.settings 28 | 29 | 30 | 31 | 1 32 | 1.31.1 33 | 34 | 35 | 36 | org.netbeans.modules.lexer 37 | 38 | 39 | 40 | 2 41 | 1.35.1.1 42 | 43 | 44 | 45 | org.netbeans.modules.parsing.api 46 | 47 | 48 | 49 | 1 50 | 1.33.2.4 51 | 52 | 53 | 54 | org.netbeans.spi.editor.hints 55 | 56 | 57 | 58 | 0-1 59 | 1.14.1.7.2 60 | 61 | 62 | 63 | org.openide.filesystems 64 | 65 | 66 | 67 | 7.38.2 68 | 69 | 70 | 71 | org.openide.loaders 72 | 73 | 74 | 75 | 7.16.1 76 | 77 | 78 | 79 | org.openide.nodes 80 | 81 | 82 | 83 | 7.16.1 84 | 85 | 86 | 87 | org.openide.text 88 | 89 | 90 | 91 | 6.30.1 92 | 93 | 94 | 95 | org.openide.util 96 | 97 | 98 | 99 | 100 | org.openide.util.lookup 101 | 102 | 103 | 104 | 105 | org.openide.windows 106 | 107 | 108 | 109 | 6.33.1 110 | 111 | 112 | 113 | 114 | 115 | ext/antlr-3.3-complete.jar 116 | release/modules/ext/antlr-3.3-complete.jar 117 | 118 | 119 | 120 | 121 | -------------------------------------------------------------------------------- /plugin/valaproject/src/org/carbonfx/valaproject/editor/ValaIndentTask.java: -------------------------------------------------------------------------------- 1 | /* 2 | * CarbonFX ValaProject is a plugin for Netbeans IDE for Vala. 3 | * 4 | * Copyright (c) 2011 Carbon Foundation X. All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are met: 8 | * * Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * * Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * * Neither the name of the Carbon Foundation X nor the 14 | * names of its contributors may be used to endorse or promote products 15 | * derived from this software without specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 19 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | * DISCLAIMED. IN NO EVENT SHALL Carbon Foundation X BE LIABLE FOR ANY 21 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 24 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 | * 27 | */ 28 | package org.carbonfx.valaproject.editor; 29 | 30 | import org.carbonfx.valaproject.options.CodeStyle; 31 | import javax.swing.text.BadLocationException; 32 | import org.netbeans.editor.BaseDocument; 33 | import org.netbeans.modules.editor.indent.spi.Context; 34 | import org.netbeans.modules.editor.indent.spi.ExtraLock; 35 | import org.netbeans.modules.editor.indent.spi.IndentTask; 36 | import org.netbeans.editor.Utilities; 37 | 38 | public class ValaIndentTask implements IndentTask { 39 | 40 | private Context context; 41 | private CodeStyle codeStyle; 42 | 43 | public ValaIndentTask(Context context) { 44 | 45 | this.context = context; 46 | this.codeStyle = CodeStyle.getCodeStyle(context.document()); 47 | } 48 | 49 | @Override 50 | public void reindent() throws BadLocationException { 51 | 52 | int caretOffset = context.caretOffset(); 53 | int lineOffset = context.lineStartOffset(caretOffset); 54 | 55 | final BaseDocument doc = (BaseDocument) context.document(); 56 | 57 | int lastNonWhite = Utilities.getFirstNonWhiteBwd(doc, lineOffset); 58 | 59 | IndentMode mode = getMode(lineOffset, lastNonWhite, doc); 60 | int currentIndent = getCurrentIndent(lastNonWhite, doc); 61 | 62 | switch (mode) { 63 | case NEW_BLOCK: 64 | indentNewBlock(lineOffset, currentIndent); 65 | break; 66 | 67 | case SAME_LEVEL: 68 | indentSameLevel(lineOffset, currentIndent); 69 | break; 70 | } 71 | } 72 | 73 | @Override 74 | public ExtraLock indentLock() { 75 | return null; 76 | } 77 | 78 | private IndentMode getMode(int lineOffset, int lastNonWhite, BaseDocument doc) throws BadLocationException { 79 | IndentMode mode = IndentMode.UNKNOWN; 80 | if (lastNonWhite >= 0 && lastNonWhite < lineOffset) { 81 | String s = doc.getText(lastNonWhite, 1); 82 | if (s != null && s.equals("{")) { 83 | mode = IndentMode.NEW_BLOCK; 84 | } else { 85 | mode = IndentMode.SAME_LEVEL; 86 | } 87 | } 88 | return mode; 89 | } 90 | 91 | private int getCurrentIndent(int lastNonWhite, BaseDocument doc) throws BadLocationException { 92 | int prevLineStart = Utilities.getRowStart(doc, lastNonWhite); 93 | int currentIndent = 0; 94 | if (prevLineStart >= 0) { 95 | int p = Utilities.getFirstNonWhiteFwd(doc, prevLineStart); 96 | if (p >= 0 && p >= prevLineStart && p <= lastNonWhite) { 97 | String s = doc.getText(prevLineStart, p - prevLineStart); 98 | 99 | for (int i = 0; i < s.length(); ++i) { 100 | if (s.charAt(i) == '\t') { 101 | currentIndent += codeStyle.getTabSize(); 102 | } else { 103 | currentIndent++; 104 | } 105 | } 106 | } 107 | } 108 | return currentIndent; 109 | } 110 | 111 | private void indentNewBlock(int lineOffset, int indent) throws BadLocationException { 112 | final BaseDocument doc = (BaseDocument) context.document(); 113 | 114 | int countLCurl = getCurlCount(false, lineOffset, doc); 115 | int countRCurl = getCurlCount(true, lineOffset, doc); 116 | 117 | String s = getIndentString(indent + codeStyle.getIndentSize()); 118 | int newCaretPos = lineOffset + s.length(); 119 | 120 | if (countLCurl == (countRCurl + 1)) { 121 | 122 | s += "\n"; 123 | s += getIndentString(indent); 124 | s += "}"; 125 | } 126 | 127 | doc.insertString(lineOffset, s, null); 128 | context.setCaretOffset(newCaretPos); 129 | } 130 | 131 | private void indentSameLevel(int lineOffset, int indent) throws BadLocationException { 132 | final BaseDocument doc = (BaseDocument) context.document(); 133 | String s = getIndentString(indent); 134 | int newCaretPos = lineOffset + s.length(); 135 | doc.insertString(lineOffset, s, null); 136 | context.setCaretOffset(newCaretPos); 137 | } 138 | 139 | private int getCurlCount(boolean forward, int offset, BaseDocument doc) throws BadLocationException { 140 | 141 | char fwchar, bwchar; 142 | int from; 143 | int to; 144 | int incval; 145 | if (forward) { 146 | fwchar = '}'; 147 | bwchar = '{'; 148 | from = offset; 149 | to = doc.getLength(); 150 | incval = 1; 151 | } else { 152 | fwchar = '{'; 153 | bwchar = '}'; 154 | from = offset; 155 | to = 0; 156 | incval = -1; 157 | } 158 | 159 | int count = 0; 160 | char ca[] = new char[1]; 161 | int mode = 0; // 1 = ', 2 = " 162 | 163 | for (int i = from; i != to; i += incval) { 164 | doc.getChars(i, ca, 0, 1); 165 | 166 | char c = ca[0]; 167 | 168 | if (c == fwchar && mode == 0) { 169 | count++; 170 | } 171 | 172 | if (c == bwchar && mode == 0) { 173 | count--; 174 | } 175 | 176 | if (c == '"') { 177 | if (mode == 0) { 178 | mode = 2; 179 | } else if (mode == 2) { 180 | mode = 0; 181 | } 182 | } 183 | 184 | if (c == '\'') { 185 | if (mode == 0) { 186 | mode = 1; 187 | } else if (mode == 1) { 188 | mode = 0; 189 | } 190 | } 191 | } 192 | return count; 193 | } 194 | 195 | private String getIndentString(int indent) { 196 | 197 | StringBuilder sb = new StringBuilder(indent + 2); 198 | 199 | if (codeStyle.getExpandTabToSpaces()) { 200 | 201 | for (int i = 0; i < indent; ++i) { 202 | sb.append(' '); 203 | } 204 | 205 | } else { 206 | 207 | int tabCount = indent / codeStyle.getTabSize(); 208 | int spaceCount = indent % codeStyle.getTabSize(); 209 | 210 | for (int i = 0; i < tabCount; ++i) { 211 | sb.append('\t'); 212 | } 213 | 214 | for (int i = 0; i < spaceCount; ++i) { 215 | sb.append(' '); 216 | } 217 | } 218 | 219 | return sb.toString(); 220 | } 221 | 222 | private enum IndentMode { 223 | 224 | UNKNOWN, 225 | NEW_BLOCK, 226 | SAME_LEVEL 227 | }; 228 | } 229 | -------------------------------------------------------------------------------- /plugin/valaproject/src/org/carbonfx/valaproject/lexer/ValaLanguageHierarchy.java: -------------------------------------------------------------------------------- 1 | /* 2 | * CarbonFX ValaProject is a plugin for Netbeans IDE for Vala. 3 | * 4 | * Copyright (c) 2011 Carbon Foundation X. All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are met: 8 | * * Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * * Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * * Neither the name of the Carbon Foundation X nor the 14 | * names of its contributors may be used to endorse or promote products 15 | * derived from this software without specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 19 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | * DISCLAIMED. IN NO EVENT SHALL Carbon Foundation X BE LIABLE FOR ANY 21 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 24 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 | * 27 | */ 28 | package org.carbonfx.valaproject.lexer; 29 | 30 | import java.util.Arrays; 31 | import java.util.Collection; 32 | import java.util.HashMap; 33 | import java.util.Map; 34 | import org.carbonfx.valaproject.antlr.ValaLexer; 35 | import org.carbonfx.valaproject.antlr.ValaParser; 36 | import org.netbeans.spi.lexer.LanguageHierarchy; 37 | import org.netbeans.spi.lexer.Lexer; 38 | import org.netbeans.spi.lexer.LexerRestartInfo; 39 | 40 | public class ValaLanguageHierarchy extends LanguageHierarchy { 41 | 42 | @Override 43 | protected Collection createTokenIds() { 44 | return Arrays.asList(tokens); 45 | } 46 | 47 | @Override 48 | protected Lexer createLexer(LexerRestartInfo lri) { 49 | return new org.carbonfx.valaproject.lexer.ValaLexer(lri); 50 | } 51 | 52 | @Override 53 | protected String mimeType() { 54 | return "text/x-vala"; 55 | } 56 | 57 | static synchronized ValaTokenId getToken(int id) { 58 | return idToToken.get(id); 59 | } 60 | private static final Map idToToken = new HashMap(); 61 | private static final ValaTokenId[] tokens = new ValaTokenId[]{ 62 | token(ValaLexer.AND, "operator"), 63 | token(ValaLexer.AND_ASSIGN, "operator"), 64 | token(ValaLexer.ASSIGNMENT, "operator"), 65 | token(ValaLexer.BITWISE_NOT, "operator"), 66 | token(ValaLexer.BOOL_AND, "operator"), 67 | token(ValaLexer.BOOL_OR, "operator"), 68 | token(ValaLexer.CHAR, "character"), 69 | token(ValaLexer.COALESCE, "operator"), 70 | token(ValaLexer.COLON, "separator"), 71 | token(ValaLexer.COMMA, "separator"), 72 | token(ValaLexer.COMMENT, "comment"), 73 | token(ValaLexer.COMMENT_JAVADOC, "javadoc"), 74 | token(ValaLexer.DECR_ASSIGN, "operator"), 75 | token(ValaLexer.DECREMENT, "operator"), 76 | token(ValaLexer.DIGITS, "number"), 77 | token(ValaLexer.DIV, "operator"), 78 | token(ValaLexer.DIV_ASSIGN, "operator"), 79 | token(ValaLexer.DOT, "separator"), 80 | token(ValaLexer.ELIPSIS, "operator"), 81 | token(ValaLexer.EQUAL, "operator"), 82 | token(ValaLexer.ESCAPE, "string"), 83 | token(ValaLexer.EXPONENT, "number"), 84 | token(ValaLexer.GLOBAL_NS, "identifier"), 85 | token(ValaLexer.GT, "operator"), 86 | token(ValaLexer.GTEQ, "operator"), 87 | token(ValaLexer.HEX, "number"), 88 | token(ValaLexer.HEXDIGIT, "number"), 89 | token(ValaLexer.IDENTIFIER, "identifier"), 90 | token(ValaLexer.INCR_ASSIGN, "operator"), 91 | token(ValaLexer.INCREMENT, "operator"), 92 | token(ValaLexer.INTEGER, "number"), 93 | token(ValaLexer.KW_ABSTRACT, "keyword"), 94 | token(ValaLexer.KW_AS, "keyword"), 95 | token(ValaLexer.KW_ASYNC, "keyword"), 96 | token(ValaLexer.KW_BASE, "keyword"), 97 | token(ValaLexer.KW_BREAK, "keyword"), 98 | token(ValaLexer.KW_CASE, "keyword"), 99 | token(ValaLexer.KW_CATCH, "keyword"), 100 | token(ValaLexer.KW_CLASS, "keyword"), 101 | token(ValaLexer.KW_CONST, "keyword"), 102 | token(ValaLexer.KW_CONSTRUCT, "keyword"), 103 | token(ValaLexer.KW_CONTINUE, "keyword"), 104 | token(ValaLexer.KW_DEFAULT, "keyword"), 105 | token(ValaLexer.KW_DELEGATE, "keyword"), 106 | token(ValaLexer.KW_DELETE, "keyword"), 107 | token(ValaLexer.KW_DO, "keyword"), 108 | token(ValaLexer.KW_DYNAMIC, "keyword"), 109 | token(ValaLexer.KW_ELSE, "keyword"), 110 | token(ValaLexer.KW_ENSURES, "keyword"), 111 | token(ValaLexer.KW_ENUM, "keyword"), 112 | token(ValaLexer.KW_ERRORDOMAIN, "keyword"), 113 | token(ValaLexer.KW_EXTERN, "keyword"), 114 | token(ValaLexer.KW_FALSE, "keyword"), 115 | token(ValaLexer.KW_FINALLY, "keyword"), 116 | token(ValaLexer.KW_FOR, "keyword"), 117 | token(ValaLexer.KW_FOREACH, "keyword"), 118 | token(ValaLexer.KW_GET, "keyword"), 119 | token(ValaLexer.KW_IF, "keyword"), 120 | token(ValaLexer.KW_IN, "keyword"), 121 | token(ValaLexer.KW_INLINE, "keyword"), 122 | token(ValaLexer.KW_INTERFACE, "keyword"), 123 | token(ValaLexer.KW_INTERNAL, "keyword"), 124 | token(ValaLexer.KW_IS, "keyword"), 125 | token(ValaLexer.KW_LOCK, "keyword"), 126 | token(ValaLexer.KW_NAMESPACE, "keyword"), 127 | token(ValaLexer.KW_NEW, "keyword"), 128 | token(ValaLexer.KW_NULL, "keyword"), 129 | token(ValaLexer.KW_OUT, "keyword"), 130 | token(ValaLexer.KW_OVERRIDE, "keyword"), 131 | token(ValaLexer.KW_OWNED, "keyword"), 132 | token(ValaLexer.KW_PARAMS, "keyword"), 133 | token(ValaLexer.KW_PRIVATE, "keyword"), 134 | token(ValaLexer.KW_PROTECTED, "keyword"), 135 | token(ValaLexer.KW_PUBLIC, "keyword"), 136 | token(ValaLexer.KW_REF, "keyword"), 137 | token(ValaLexer.KW_REQUIRES, "keyword"), 138 | token(ValaLexer.KW_RETURN, "keyword"), 139 | token(ValaLexer.KW_SET, "keyword"), 140 | token(ValaLexer.KW_SIGNAL, "keyword"), 141 | token(ValaLexer.KW_SIZEOF, "keyword"), 142 | token(ValaLexer.KW_STATIC, "keyword"), 143 | token(ValaLexer.KW_STRUCT, "keyword"), 144 | token(ValaLexer.KW_SWITCH, "keyword"), 145 | token(ValaLexer.KW_THIS, "keyword"), 146 | token(ValaLexer.KW_THROW, "keyword"), 147 | token(ValaLexer.KW_THROWS, "keyword"), 148 | token(ValaLexer.KW_TRUE, "keyword"), 149 | token(ValaLexer.KW_TRY, "keyword"), 150 | token(ValaLexer.KW_TYPEOF, "keyword"), 151 | token(ValaLexer.KW_UNOWNED, "keyword"), 152 | token(ValaLexer.KW_USING, "keyword"), 153 | token(ValaLexer.KW_VAR, "keyword"), 154 | token(ValaLexer.KW_VIRTUAL, "keyword"), 155 | token(ValaLexer.KW_VOID, "keyword"), 156 | token(ValaLexer.KW_WEAK, "keyword"), 157 | token(ValaLexer.KW_WHILE, "keyword"), 158 | token(ValaLexer.KW_YIELD, "keyword"), 159 | token(ValaLexer.LAMBDA, "operator"), 160 | token(ValaLexer.LBRACKET, "separator"), 161 | token(ValaLexer.LCURL, "separator"), 162 | token(ValaLexer.LINE_COMMAND, "command"), 163 | token(ValaLexer.LINE_COMMENT, "comment"), 164 | token(ValaLexer.LPAREN, "separator"), 165 | token(ValaLexer.LT, "operator"), 166 | token(ValaLexer.LTEQ, "operator"), 167 | token(ValaLexer.MINUS, "operator"), 168 | token(ValaLexer.MOD, "operator"), 169 | token(ValaLexer.MOD_ASSIGN, "operator"), 170 | token(ValaLexer.MUL_ASSIGN, "operator"), 171 | token(ValaLexer.MULTIPLY, "operator"), 172 | token(ValaLexer.NOT, "operator"), 173 | token(ValaLexer.NOT_EQUAL, "operator"), 174 | token(ValaLexer.OCTAL, "number"), 175 | token(ValaLexer.OR, "operator"), 176 | token(ValaLexer.OR_ASSIGN, "operator"), 177 | token(ValaLexer.PLUS, "operator"), 178 | token(ValaLexer.POINTER_ACCESS, "operator"), 179 | token(ValaLexer.QUESTION, "operator"), 180 | token(ValaLexer.QUOT, "character"), 181 | token(ValaLexer.RANGE, "operator"), 182 | token(ValaLexer.RBRACKET, "separator"), 183 | token(ValaLexer.RCURL, "separator"), 184 | token(ValaLexer.REAL, "number"), 185 | token(ValaLexer.REGEX_LITERAL, "regex"), 186 | token(ValaLexer.RPAREN, "separator"), 187 | token(ValaLexer.SEMICOLON, "separator"), 188 | token(ValaLexer.SHIFT_LEFT, "operator"), 189 | token(ValaLexer.SHL_ASSIGN, "operator"), 190 | token(ValaLexer.SHR_ASSIGN, "operator"), 191 | token(ValaLexer.STRING, "string"), 192 | token(ValaLexer.TEMPLATE_START, "string"), 193 | token(ValaLexer.UNICODE, "character"), 194 | token(ValaLexer.VERBATIM_LITERAL, "string"), 195 | token(ValaLexer.WHITESPACE, "separator"), 196 | token(ValaLexer.XOR, "operator"), 197 | token(ValaLexer.XOR_ASSIGN, "operator"), 198 | token(ValaLexer.BACKSLASH, "operator"), 199 | token(ValaLexer.UNICODE_CHAR, "error"), 200 | token(ValaLexer.OTHER_CHAR, "error"), 201 | token(ValaLexer.UNKNOWN_CHAIN, "error"),}; 202 | 203 | static { 204 | for (ValaTokenId token : tokens) { 205 | idToToken.put(token.ordinal(), token); 206 | } 207 | } 208 | 209 | private static ValaTokenId token(int antlrToken, String category) { 210 | return new ValaTokenId(ValaParser.tokenNames[antlrToken], category, antlrToken); 211 | } 212 | } 213 | -------------------------------------------------------------------------------- /plugin/valaproject/src/org/carbonfx/valaproject/layer.xml: -------------------------------------------------------------------------------- 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 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 239 | 240 | 241 | 242 | 243 | 244 | -------------------------------------------------------------------------------- /antlr/Vala.g: -------------------------------------------------------------------------------- 1 | grammar Vala; 2 | 3 | options { 4 | backtrack=true; 5 | memoize=true; 6 | output=AST; 7 | ASTLabelType=CommonTree; 8 | } 9 | 10 | tokens { UNKNOWN_CHAIN; } 11 | 12 | @header { package org.carbonfx.valaproject.antlr; } 13 | @lexer::header { package org.carbonfx.valaproject.antlr; } 14 | 15 | @members { 16 | public List syntaxErrors = new ArrayList(); 17 | private java.util.regex.Pattern msgPattern = java.util.regex.Pattern.compile(".*missing KW_([A-Z]*) at (.*)"); 18 | 19 | @Override 20 | public String getErrorMessage(RecognitionException e, String[] tokenNames) { 21 | String message = super.getErrorMessage(e, tokenNames); 22 | SyntaxError syntaxError = new SyntaxError(); 23 | syntaxError.exception = e; 24 | 25 | java.util.regex.Matcher m = msgPattern.matcher(message); 26 | if (m.matches()) { 27 | message = "'"+m.group(1).toLowerCase() + "' expected at " + m.group(2); 28 | } 29 | 30 | syntaxError.message = message; 31 | syntaxErrors.add(syntaxError); 32 | return message; 33 | } 34 | 35 | public static class SyntaxError { 36 | public RecognitionException exception; 37 | public String message; 38 | public int line; 39 | public int charPositionInLine; 40 | } 41 | } 42 | 43 | compilation_unit 44 | : 45 | (using_directive)* 46 | (namespace_member)*; 47 | 48 | using_directive 49 | : 50 | KW_USING 51 | symbol 52 | ( 53 | COMMA 54 | symbol 55 | )* 56 | SEMICOLON; 57 | 58 | symbol 59 | : 60 | symbol_part 61 | ( 62 | DOT 63 | symbol_part 64 | )*; 65 | 66 | symbol_part 67 | : 68 | ( GLOBAL_NS IDENTIFIER ) 69 | | IDENTIFIER; 70 | 71 | namespace_member 72 | : 73 | (attributes)? 74 | ( namespace_declaration 75 | | class_declaration 76 | | interface_declaration 77 | | struct_declaration 78 | | enum_declaration 79 | | errordomain_declaration 80 | | method_declaration 81 | | delegate_declaration 82 | | constant_declaration 83 | | field_declaration ); 84 | 85 | attributes 86 | : (attribute 87 | )+; 88 | 89 | attribute 90 | : 91 | LBRACKET 92 | identifier 93 | (attribute_arguments)? 94 | RBRACKET; 95 | 96 | attribute_arguments 97 | : 98 | LPAREN 99 | (attribute_argument (COMMA attribute_argument)*)? 100 | RPAREN; 101 | 102 | attribute_argument 103 | : identifier ASSIGNMENT expression; 104 | 105 | expression 106 | : 107 | lambda_expression 108 | | 109 | ( conditional_expression (assignment_operator expression)? ); 110 | 111 | assignment_operator 112 | : ASSIGNMENT | INCR_ASSIGN | DECR_ASSIGN | OR_ASSIGN | AND_ASSIGN | XOR_ASSIGN | DIV_ASSIGN | MUL_ASSIGN | MOD_ASSIGN | SHL_ASSIGN | SHR_ASSIGN; 113 | 114 | conditional_expression 115 | : 116 | coalescing_expression 117 | (QUESTION expression COLON expression)?; 118 | 119 | coalescing_expression 120 | : 121 | conditional_or_expression 122 | (COALESCE coalescing_expression)?; 123 | 124 | conditional_or_expression 125 | : 126 | conditional_and_expression 127 | (BOOL_OR conditional_and_expression)*; 128 | 129 | conditional_and_expression 130 | : 131 | in_expression 132 | (BOOL_AND in_expression)*; 133 | 134 | in_expression 135 | : 136 | inclusive_or_expression 137 | (KW_IN inclusive_or_expression)?; 138 | 139 | inclusive_or_expression 140 | : 141 | exclusive_or_expression 142 | (OR exclusive_or_expression)*; 143 | 144 | exclusive_or_expression 145 | : 146 | and_expression 147 | (XOR and_expression)?; 148 | 149 | and_expression 150 | : 151 | equality_expression 152 | (AND equality_expression)*; 153 | 154 | equality_expression 155 | : 156 | relational_expression 157 | (( EQUAL | NOT_EQUAL ) relational_expression)*; 158 | 159 | relational_expression 160 | : 161 | shift_expression 162 | ( 163 | (( LT | GT | LTEQ | GTEQ ) shift_expression ) 164 | | 165 | ( KW_IS type ) 166 | | 167 | ( KW_AS type ) 168 | )*; 169 | 170 | type 171 | : 172 | ( 173 | KW_VOID 174 | (MULTIPLY)* 175 | ) 176 | | 177 | ( 178 | (KW_DYNAMIC)? 179 | (KW_OWNED | KW_UNOWNED | KW_WEAK)? 180 | symbol 181 | (type_arguments)? 182 | (MULTIPLY)* 183 | (QUESTION)? 184 | (array_type)* 185 | ); 186 | 187 | array_type 188 | : 189 | LBRACKET 190 | (array_size)? 191 | RBRACKET 192 | (QUESTION)?; 193 | 194 | shift_expression 195 | : 196 | additive_expression 197 | ( 198 | ( SHIFT_LEFT | shift_right ) additive_expression 199 | )*; 200 | 201 | shift_right 202 | : 203 | GT GT; 204 | 205 | additive_expression 206 | : 207 | multiplicative_expression 208 | ( 209 | ( PLUS | MINUS ) multiplicative_expression 210 | )*; 211 | 212 | multiplicative_expression 213 | : 214 | unary_expression 215 | ( 216 | ( 217 | (MULTIPLY) 218 | | (DIV) 219 | | (MOD) 220 | ) unary_expression 221 | )*; 222 | 223 | unary_expression 224 | : 225 | ( unary_operator unary_expression ) 226 | | 227 | primary_expression; 228 | 229 | unary_operator 230 | : 231 | PLUS 232 | | MINUS 233 | | NOT 234 | | BITWISE_NOT 235 | | INCREMENT 236 | | DECREMENT 237 | | MULTIPLY 238 | | AND 239 | | cast_operator 240 | | LPAREN NOT RPAREN; 241 | 242 | cast_operator 243 | : 244 | LPAREN type RPAREN 245 | | LPAREN KW_UNOWNED RPAREN 246 | | LPAREN KW_OWNED RPAREN 247 | | LPAREN KW_WEAK RPAREN; 248 | 249 | primary_expression 250 | : 251 | ( 252 | literal 253 | | initializer 254 | | tuple 255 | | template 256 | | this_access 257 | | base_access 258 | | object_or_array_creation_expression 259 | | yield_expression 260 | | sizeof_expression 261 | | typeof_expression 262 | | simple_name 263 | ) 264 | ( 265 | member_access 266 | | pointer_member_access 267 | | method_call 268 | | element_access 269 | | post_increment_expression 270 | | post_decrement_expression 271 | )*; 272 | 273 | member_access 274 | : 275 | DOT 276 | identifier 277 | (type_arguments)?; 278 | 279 | identifier 280 | : 281 | IDENTIFIER 282 | | KW_USING 283 | | KW_CONSTRUCT 284 | | KW_SET 285 | | KW_GET 286 | | KW_IN 287 | | KW_IS 288 | | KW_AS 289 | | KW_VOID 290 | | KW_DYNAMIC 291 | | KW_OWNED 292 | | KW_WEAK 293 | | KW_UNOWNED 294 | | KW_TRUE 295 | | KW_FALSE 296 | | KW_NULL 297 | | KW_NEW 298 | | KW_YIELD 299 | | KW_SIZEOF 300 | | KW_TYPEOF 301 | | KW_ASYNC 302 | | KW_CLASS 303 | | KW_STRUCT 304 | | KW_EXTERN 305 | | KW_INLINE 306 | | KW_STATIC 307 | | KW_ABSTRACT 308 | | KW_VIRTUAL 309 | | KW_OVERRIDE 310 | | KW_PRIVATE 311 | | KW_PROTECTED 312 | | KW_PUBLIC 313 | | KW_INTERNAL 314 | | KW_ENUM 315 | | KW_ERRORDOMAIN 316 | | KW_INTERFACE 317 | | KW_NAMESPACE 318 | | KW_OUT 319 | | KW_REF 320 | | KW_PARAMS 321 | | KW_TRY 322 | | KW_CATCH 323 | | KW_FINALLY 324 | | KW_LOCK 325 | | KW_DELETE 326 | | KW_FOREACH 327 | | KW_CONTINUE 328 | | KW_RETURN 329 | | KW_BREAK 330 | | KW_VAR 331 | | KW_THROW 332 | | KW_SIGNAL 333 | | KW_REQUIRES; 334 | 335 | post_increment_expression 336 | : INCREMENT; 337 | 338 | post_decrement_expression 339 | : DECREMENT; 340 | 341 | element_access 342 | : 343 | LBRACKET 344 | expression 345 | (slice_array)? 346 | RBRACKET; 347 | 348 | slice_array 349 | : 350 | COLON 351 | expression; 352 | 353 | pointer_member_access 354 | : 355 | POINTER_ACCESS 356 | identifier 357 | (type_arguments)?; 358 | 359 | literal 360 | : 361 | boolean_literal 362 | | null_literal 363 | | open_regex_literal 364 | | vertbatim_string_literal 365 | | integer_literal 366 | | hex_literal 367 | | real_literal 368 | | char_literal 369 | | string_literal; 370 | /* TODO: template_string_literal*/ 371 | 372 | integer_literal 373 | : 374 | INTEGER; 375 | 376 | real_literal 377 | : 378 | REAL; 379 | 380 | string_literal 381 | : 382 | STRING; 383 | 384 | hex_literal 385 | : 386 | HEX; 387 | 388 | boolean_literal 389 | : KW_TRUE | KW_FALSE; 390 | 391 | null_literal 392 | : KW_NULL; 393 | 394 | char_literal 395 | : 396 | CHAR; 397 | 398 | open_regex_literal 399 | : 400 | REGEX_LITERAL; 401 | 402 | vertbatim_string_literal 403 | : 404 | VERBATIM_LITERAL; 405 | 406 | initializer 407 | : 408 | LCURL 409 | (argument 410 | (COMMA argument)*)? 411 | RCURL; 412 | 413 | arguments 414 | : 415 | argument 416 | (COMMA argument)*; 417 | 418 | argument 419 | : 420 | ( 421 | identifier 422 | COLON 423 | )? 424 | ((KW_REF) | (KW_OUT))? 425 | expression; 426 | 427 | tuple 428 | : 429 | LPAREN 430 | expression 431 | ( 432 | COMMA 433 | expression 434 | )* 435 | RPAREN; 436 | 437 | template 438 | : 439 | TEMPLATE_START 440 | (expression COMMA)* 441 | QUOT; 442 | 443 | this_access 444 | : KW_THIS; 445 | 446 | base_access 447 | : KW_BASE; 448 | 449 | object_or_array_creation_expression 450 | : 451 | KW_NEW 452 | member 453 | ( object_creation_expression | array_creation_expression ); 454 | 455 | object_creation_expression 456 | : 457 | LPAREN 458 | ( arguments )? 459 | RPAREN 460 | ( object_initializer )?; 461 | 462 | object_initializer 463 | : 464 | LCURL 465 | member_initializer 466 | ( 467 | COMMA 468 | member_initializer 469 | )? 470 | RCURL; 471 | 472 | member_initializer 473 | : identifier ASSIGNMENT expression; 474 | 475 | array_creation_expression 476 | : 477 | ( 478 | LBRACKET 479 | RBRACKET 480 | )* 481 | ( 482 | LBRACKET 483 | (array_size)? 484 | RBRACKET 485 | )? 486 | (initializer)?; 487 | 488 | array_size 489 | : 490 | expression 491 | (COMMA expression)*; 492 | 493 | member 494 | : 495 | ( 496 | GLOBAL_NS identifier 497 | | identifier 498 | ) 499 | (type_arguments)? 500 | (member_access)*; 501 | 502 | type_arguments 503 | : 504 | LT 505 | type 506 | (COMMA type)* 507 | GT; 508 | 509 | yield_expression 510 | : KW_YIELD (base_access DOT)? member method_call; 511 | 512 | method_call 513 | : 514 | LPAREN 515 | (arguments)? 516 | RPAREN 517 | (object_initializer)?; 518 | 519 | sizeof_expression 520 | : 521 | KW_SIZEOF 522 | LPAREN 523 | type 524 | RPAREN; 525 | 526 | typeof_expression 527 | : KW_TYPEOF LPAREN type RPAREN; 528 | 529 | simple_name 530 | : ( GLOBAL_NS identifier | identifier ) (type_arguments)?; 531 | 532 | lambda_expression 533 | : lambda_expression_params LAMBDA lambda_expression_body; 534 | 535 | lambda_expression_params 536 | : 537 | identifier 538 | | 539 | ( 540 | LPAREN 541 | (identifier (COMMA identifier)* )? 542 | RPAREN 543 | ); 544 | 545 | lambda_expression_body 546 | : expression | block; 547 | 548 | member_declaration_modifiers 549 | : member_declaration_modifier+; 550 | 551 | member_declaration_modifier 552 | : 553 | KW_ASYNC 554 | | KW_CLASS 555 | | KW_EXTERN 556 | | KW_INLINE 557 | | KW_STATIC 558 | | KW_ABSTRACT 559 | | KW_VIRTUAL 560 | | KW_OVERRIDE 561 | | KW_NEW; 562 | 563 | constructor_declaration 564 | : 565 | (constructor_declaration_modifiers)? 566 | KW_CONSTRUCT 567 | block; 568 | 569 | constructor_declaration_modifiers 570 | : 571 | constructor_declaration_modifier+; 572 | 573 | constructor_declaration_modifier 574 | : 575 | KW_ASYNC 576 | | KW_CLASS 577 | | KW_EXTERN 578 | | KW_INLINE 579 | | KW_STATIC 580 | | KW_ABSTRACT 581 | | KW_VIRTUAL 582 | | KW_OVERRIDE; 583 | 584 | destructor_declaration 585 | : 586 | (constructor_declaration_modifiers)? 587 | BITWISE_NOT 588 | IDENTIFIER 589 | LPAREN 590 | RPAREN 591 | block; 592 | 593 | class_declaration 594 | : 595 | (access_modifier)? 596 | (type_declaration_modifiers)? 597 | KW_CLASS 598 | symbol 599 | (type_arguments)? 600 | (COLON base_types)? 601 | LCURL 602 | (class_member)* 603 | RCURL; 604 | 605 | base_types 606 | : 607 | type 608 | (COMMA type)*; 609 | 610 | class_member 611 | : 612 | (attributes)? 613 | ( class_declaration 614 | | struct_declaration 615 | | enum_declaration 616 | | delegate_declaration 617 | | method_declaration 618 | | signal_declaration 619 | | field_declaration 620 | | constant_declaration 621 | | property_declaration 622 | | constructor_declaration 623 | | creation_method_declaration 624 | | destructor_declaration 625 | | unknown_chain); 626 | 627 | access_modifier 628 | : 629 | KW_PRIVATE 630 | | KW_PROTECTED 631 | | KW_INTERNAL 632 | | KW_PUBLIC; 633 | 634 | type_declaration_modifiers 635 | : type_declaration_modifier+; 636 | 637 | type_declaration_modifier 638 | : 639 | KW_ABSTRACT 640 | | KW_EXTERN 641 | | KW_STATIC; 642 | 643 | enum_declaration 644 | : 645 | (access_modifier)? 646 | (type_declaration_modifiers)? 647 | KW_ENUM 648 | symbol 649 | LCURL 650 | (enum_member)* 651 | RCURL; 652 | 653 | enum_member 654 | : 655 | ( 656 | (attributes)? 657 | ( 658 | method_declaration 659 | | constant_declaration 660 | | unknown_chain 661 | ) 662 | ) 663 | | 664 | (enum_values); 665 | 666 | enum_values 667 | : 668 | enum_value 669 | (COMMA enum_value)* 670 | (COMMA)? 671 | (SEMICOLON)?; 672 | 673 | enum_value 674 | : 675 | (attributes)? 676 | identifier 677 | (ASSIGNMENT expression)?; 678 | 679 | errordomain_declaration 680 | : 681 | (access_modifier)? 682 | (type_declaration_modifiers)? 683 | KW_ERRORDOMAIN 684 | symbol 685 | LCURL 686 | errorcodes 687 | (SEMICOLON (method_declaration)*)? 688 | RCURL; 689 | 690 | errorcodes 691 | : 692 | errorcode 693 | (COMMA errorcode)* 694 | (COMMA)?; 695 | 696 | errorcode 697 | : (attributes)? IDENTIFIER (ASSIGNMENT expression)?; 698 | 699 | interface_declaration 700 | : 701 | (access_modifier)? 702 | (type_declaration_modifiers)? 703 | KW_INTERFACE 704 | symbol 705 | (type_parameters)? 706 | (COLON base_types)? 707 | LCURL 708 | (interface_member)* 709 | RCURL; 710 | 711 | type_parameters 712 | : 713 | LT 714 | identifier 715 | (COMMA identifier)* 716 | GT; 717 | 718 | interface_member 719 | : (attributes)? 720 | ( 721 | class_declaration 722 | | struct_declaration 723 | | enum_declaration 724 | | delegate_declaration 725 | | method_declaration 726 | | signal_declaration 727 | | field_declaration 728 | | constant_declaration 729 | | property_declaration ); 730 | 731 | namespace_declaration 732 | : 733 | KW_NAMESPACE 734 | symbol 735 | LCURL 736 | (using_directive)* 737 | (namespace_member)* 738 | RCURL; 739 | 740 | struct_declaration 741 | : 742 | (access_modifier)? 743 | (type_declaration_modifiers)? 744 | KW_STRUCT 745 | symbol 746 | (COLON base_types)? 747 | LCURL 748 | (struct_member)* 749 | RCURL; 750 | 751 | struct_member 752 | : 753 | (attributes)? 754 | ( 755 | method_declaration 756 | | field_declaration 757 | | constant_declaration 758 | | property_declaration 759 | | creation_method_declaration 760 | | unknown_chain 761 | ); 762 | 763 | creation_method_declaration 764 | : 765 | (access_modifier)? 766 | (constructor_declaration_modifiers)? 767 | symbol 768 | parameters 769 | (throws_part)? 770 | (requires_decl)? 771 | (ensures_decl)? 772 | (SEMICOLON | block); 773 | 774 | throws_part 775 | : 776 | KW_THROWS 777 | type 778 | (COMMA type)*; 779 | 780 | parameters 781 | : 782 | LPAREN 783 | (parameters_decl)? 784 | RPAREN; 785 | 786 | parameters_decl 787 | : 788 | parameter 789 | (COMMA parameter)*; 790 | 791 | 792 | 793 | requires_decl 794 | : 795 | KW_REQUIRES 796 | LPAREN 797 | expression 798 | RPAREN 799 | (requires_decl)?; 800 | 801 | parameter 802 | : 803 | (attributes)? 804 | ( 805 | ELIPSIS 806 | | 807 | ( 808 | (KW_PARAMS)? 809 | ((KW_OWNED) | (KW_UNOWNED))? 810 | ((KW_REF) | (KW_OUT))? 811 | type 812 | identifier 813 | (ASSIGNMENT expression)? 814 | ) 815 | ); 816 | 817 | ensures_decl 818 | : 819 | KW_ENSURES 820 | LPAREN 821 | expression 822 | RPAREN 823 | (ensures_decl)?; 824 | 825 | delegate_declaration 826 | : 827 | (access_modifier)? 828 | (delegate_declaration_modifiers)? 829 | KW_DELEGATE 830 | type 831 | symbol 832 | (type_parameters)? 833 | parameters 834 | (throws_part)? 835 | SEMICOLON; 836 | 837 | delegate_declaration_modifiers 838 | : delegate_declaration_modifier+; 839 | 840 | delegate_declaration_modifier 841 | : 842 | KW_ASYNC 843 | | KW_CLASS 844 | | KW_EXTERN 845 | | KW_INLINE 846 | | KW_ABSTRACT 847 | | KW_VIRTUAL 848 | | KW_OVERRIDE 849 | | KW_STATIC; 850 | 851 | signal_declaration 852 | : 853 | (access_modifier)? 854 | (signal_declaration_modifiers)? 855 | KW_SIGNAL 856 | type 857 | IDENTIFIER 858 | parameters 859 | ( SEMICOLON | block ); 860 | 861 | signal_declaration_modifiers 862 | : signal_declaration_modifier+; 863 | 864 | signal_declaration_modifier 865 | : 866 | KW_ASYNC 867 | | KW_EXTERN 868 | | KW_INLINE 869 | | KW_ABSTRACT 870 | | KW_VIRTUAL 871 | | KW_OVERRIDE 872 | | KW_NEW; 873 | 874 | method_declaration 875 | : 876 | (access_modifier)? 877 | (member_declaration_modifiers)? 878 | type 879 | identifier 880 | (type_parameters)? 881 | parameters 882 | (throws_part)? 883 | (requires_decl)? 884 | (ensures_decl)? 885 | ( SEMICOLON | block ); 886 | 887 | constant_declaration 888 | : 889 | (access_modifier)? 890 | (member_declaration_modifiers)? 891 | KW_CONST 892 | type 893 | IDENTIFIER 894 | (inline_array_type)? 895 | (ASSIGNMENT expression)? 896 | SEMICOLON; 897 | 898 | inline_array_type 899 | : 900 | LBRACKET 901 | INTEGER 902 | RBRACKET; 903 | 904 | field_declaration 905 | : 906 | (access_modifier)? 907 | (member_declaration_modifiers)? 908 | type 909 | identifier 910 | (LBRACKET RBRACKET)? 911 | (ASSIGNMENT expression)? 912 | SEMICOLON; 913 | 914 | property_declaration 915 | : 916 | (access_modifier)? 917 | (property_declaration_modifiers)? 918 | type identifier 919 | LCURL 920 | (property_declaration_part)* 921 | RCURL; 922 | 923 | property_declaration_part 924 | : 925 | ( 926 | KW_DEFAULT 927 | ASSIGNMENT 928 | expression 929 | SEMICOLON 930 | ) 931 | | property_accessor; 932 | 933 | property_accessor 934 | : 935 | (attributes)? 936 | (access_modifier)? 937 | (KW_OWNED | KW_UNOWNED)? 938 | ( 939 | (property_get_accessor property_set_construct_accessor) 940 | | (property_set_construct_accessor property_get_accessor) 941 | | (property_set_construct_accessor) 942 | | (property_get_accessor) 943 | ); 944 | 945 | property_get_accessor 946 | : 947 | (access_modifier)? 948 | KW_GET 949 | ( SEMICOLON | block ); 950 | 951 | property_set_construct_accessor 952 | : 953 | ( 954 | (access_modifier)? 955 | ( 956 | ( KW_SET (KW_CONSTRUCT)? ) 957 | | ( KW_CONSTRUCT ) 958 | | ( KW_CONSTRUCT KW_SET ) 959 | ) 960 | ) 961 | ( 962 | SEMICOLON 963 | | block 964 | ); 965 | 966 | property_declaration_modifiers 967 | : property_declaration_modifier+; 968 | 969 | property_declaration_modifier 970 | : 971 | KW_CLASS 972 | | KW_STATIC 973 | | KW_EXTERN 974 | | KW_INLINE 975 | | KW_ABSTRACT 976 | | KW_VIRTUAL 977 | | KW_OVERRIDE 978 | | KW_NEW; 979 | 980 | block 981 | : 982 | LCURL 983 | (statement)* 984 | RCURL; 985 | 986 | statement 987 | : 988 | block 989 | | SEMICOLON 990 | | if_statement 991 | | switch_statement 992 | | while_statement 993 | | do_statement 994 | | for_statement 995 | | foreach_statement 996 | | break_statement 997 | | continue_statement 998 | | return_statement 999 | | yield_statement 1000 | | throw_statement 1001 | | try_statement 1002 | | lock_statement 1003 | | delete_statement 1004 | | local_variable_declarations 1005 | | expression_statement; 1006 | 1007 | if_statement 1008 | : 1009 | KW_IF 1010 | LPAREN 1011 | expression 1012 | RPAREN 1013 | embedded_statement 1014 | ( 1015 | KW_ELSE 1016 | embedded_statement 1017 | )?; 1018 | 1019 | embedded_statement 1020 | : 1021 | block 1022 | | embedded_statement_without_block; 1023 | 1024 | embedded_statement_without_block 1025 | : 1026 | SEMICOLON 1027 | | if_statement 1028 | | switch_statement 1029 | | while_statement 1030 | | do_statement 1031 | | for_statement 1032 | | foreach_statement 1033 | | break_statement 1034 | | continue_statement 1035 | | return_statement 1036 | | yield_statement 1037 | | throw_statement 1038 | | try_statement 1039 | | lock_statement 1040 | | delete_statement 1041 | | expression_statement; 1042 | 1043 | switch_statement 1044 | : 1045 | KW_SWITCH 1046 | LPAREN 1047 | expression 1048 | RPAREN 1049 | LCURL 1050 | (switch_section)* 1051 | RCURL; 1052 | 1053 | switch_section 1054 | : 1055 | ( 1056 | ( KW_CASE expression ) 1057 | | ( KW_DEFAULT ) 1058 | ) 1059 | COLON 1060 | (statement)* 1061 | (KW_BREAK)?; 1062 | 1063 | while_statement 1064 | : KW_WHILE LPAREN expression RPAREN embedded_statement; 1065 | 1066 | do_statement 1067 | : KW_DO embedded_statement KW_WHILE LPAREN expression RPAREN SEMICOLON; 1068 | 1069 | for_statement 1070 | : 1071 | KW_FOR 1072 | LPAREN 1073 | ( 1074 | SEMICOLON 1075 | | (for_initializer) 1076 | ) 1077 | (expression)? 1078 | SEMICOLON 1079 | (for_iterator)? 1080 | RPAREN 1081 | embedded_statement; 1082 | 1083 | for_initializer 1084 | : local_variable_declarations 1085 | | 1086 | ( 1087 | statement_expression 1088 | (COMMA statement_expression)* 1089 | SEMICOLON 1090 | ); 1091 | 1092 | for_iterator 1093 | : 1094 | statement_expression 1095 | (COMMA statement_expression)*; 1096 | 1097 | statement_expression 1098 | : expression; 1099 | 1100 | foreach_statement 1101 | : 1102 | KW_FOREACH 1103 | LPAREN 1104 | ( 1105 | type 1106 | | KW_VAR 1107 | ) 1108 | IDENTIFIER 1109 | KW_IN 1110 | expression 1111 | RPAREN 1112 | embedded_statement; 1113 | 1114 | break_statement 1115 | : KW_BREAK SEMICOLON; 1116 | 1117 | continue_statement 1118 | : KW_CONTINUE SEMICOLON; 1119 | 1120 | return_statement 1121 | : KW_RETURN (expression 1122 | )? SEMICOLON; 1123 | 1124 | yield_statement 1125 | : KW_YIELD (expression_statement | KW_RETURN expression 1126 | )? SEMICOLON; 1127 | 1128 | throw_statement 1129 | : KW_THROW expression SEMICOLON; 1130 | 1131 | try_statement 1132 | : 1133 | KW_TRY 1134 | block 1135 | (catch_clause)* 1136 | (finally_clause)?; 1137 | 1138 | catch_clause 1139 | : KW_CATCH (LPAREN type IDENTIFIER RPAREN)? block; 1140 | 1141 | finally_clause 1142 | : 1143 | KW_FINALLY 1144 | block; 1145 | 1146 | lock_statement 1147 | : KW_LOCK LPAREN expression RPAREN embedded_statement; 1148 | 1149 | delete_statement 1150 | : KW_DELETE expression SEMICOLON; 1151 | 1152 | local_variable_declarations 1153 | : 1154 | ( KW_VAR | type ) 1155 | local_variable_declaration 1156 | (COMMA local_variable_declaration)* 1157 | (SEMICOLON); 1158 | 1159 | local_variable_declaration 1160 | : 1161 | local_tuple_declaration 1162 | | local_variable; 1163 | 1164 | local_tuple_declaration 1165 | : 1166 | LPAREN 1167 | IDENTIFIER 1168 | (COMMA IDENTIFIER)* 1169 | RPAREN 1170 | ASSIGNMENT 1171 | expression; 1172 | 1173 | local_variable 1174 | : 1175 | identifier 1176 | (inline_array_type)? 1177 | (ASSIGNMENT expression)?; 1178 | 1179 | expression_statement 1180 | : 1181 | statement_expression SEMICOLON; 1182 | 1183 | unknown_chain 1184 | : 1185 | (identifier)+ 1186 | SEMICOLON 1187 | -> ^(UNKNOWN_CHAIN (identifier)+); 1188 | 1189 | /******************************************************************************************** 1190 | Lexer section 1191 | *********************************************************************************************/ 1192 | 1193 | WHITESPACE : 1194 | (' ' 1195 | | '\t' 1196 | | '\r' 1197 | | '\n' 1198 | | '\u000C' 1199 | ) { $channel=HIDDEN; }; 1200 | 1201 | 1202 | COMMENT_JAVADOC: ; 1203 | 1204 | COMMENT 1205 | : '/*' 1206 | ( 1207 | {input.LA(1) == '*'}?=> 1208 | ('*'{ $type = COMMENT_JAVADOC; }) 1209 | | { $type = COMMENT; } 1210 | ) 1211 | (options {greedy=false;} : .)* 1212 | '*/' 1213 | { $channel=HIDDEN; }; 1214 | 1215 | 1216 | LINE_COMMENT 1217 | : 1218 | ( 1219 | '//' 1220 | ~('\n' | '\r')* 1221 | ('\r\n' | '\r' | '\n') 1222 | | 1223 | '//' ~('\n' | '\r')* // a line comment could appear at the end of the file without CR/LF 1224 | ) 1225 | { $channel=HIDDEN; } 1226 | ; 1227 | 1228 | KW_USING 1229 | : 'using'; 1230 | 1231 | KW_CONSTRUCT 1232 | : 'construct'; 1233 | 1234 | KW_SET 1235 | : 'set'; 1236 | 1237 | KW_GET 1238 | : 'get'; 1239 | 1240 | KW_IN 1241 | : 'in'; 1242 | 1243 | KW_IS 1244 | : 'is'; 1245 | 1246 | KW_AS 1247 | : 'as'; 1248 | 1249 | KW_VOID 1250 | : 'void'; 1251 | 1252 | KW_DYNAMIC 1253 | : 'dynamic'; 1254 | 1255 | KW_OWNED 1256 | : 'owned'; 1257 | 1258 | KW_WEAK 1259 | : 'weak'; 1260 | 1261 | KW_UNOWNED 1262 | : 'unowned'; 1263 | 1264 | KW_TRUE 1265 | : 'true'; 1266 | 1267 | KW_FALSE 1268 | : 'false'; 1269 | 1270 | KW_NULL 1271 | : 'null'; 1272 | 1273 | KW_NEW 1274 | : 'new'; 1275 | 1276 | KW_YIELD 1277 | : 'yield'; 1278 | 1279 | KW_SIZEOF 1280 | : 'sizeof'; 1281 | 1282 | KW_TYPEOF 1283 | : 'typeof'; 1284 | 1285 | KW_ASYNC 1286 | : 'async'; 1287 | 1288 | KW_CLASS 1289 | : 'class'; 1290 | 1291 | KW_STRUCT 1292 | : 'struct'; 1293 | 1294 | KW_EXTERN 1295 | : 'extern'; 1296 | 1297 | KW_INLINE 1298 | : 'inline'; 1299 | 1300 | KW_STATIC 1301 | : 'static'; 1302 | 1303 | KW_ABSTRACT 1304 | : 'abstract'; 1305 | 1306 | KW_VIRTUAL 1307 | : 'virtual'; 1308 | 1309 | KW_OVERRIDE 1310 | : 'override'; 1311 | 1312 | KW_PRIVATE 1313 | : 'private'; 1314 | 1315 | KW_PROTECTED 1316 | : 'protected'; 1317 | 1318 | KW_PUBLIC 1319 | : 'public'; 1320 | 1321 | KW_INTERNAL 1322 | : 'internal'; 1323 | 1324 | KW_ENUM 1325 | : 'enum'; 1326 | 1327 | KW_ERRORDOMAIN 1328 | : 'errordomain'; 1329 | 1330 | KW_INTERFACE 1331 | : 'interface'; 1332 | 1333 | KW_NAMESPACE 1334 | : 'namespace'; 1335 | 1336 | KW_OUT 1337 | : 'out'; 1338 | 1339 | KW_REF 1340 | : 'ref'; 1341 | 1342 | KW_PARAMS 1343 | : 'params'; 1344 | 1345 | KW_TRY 1346 | : 'try'; 1347 | 1348 | KW_CATCH 1349 | : 'catch'; 1350 | 1351 | KW_FINALLY 1352 | : 'finally'; 1353 | 1354 | KW_LOCK 1355 | : 'lock'; 1356 | 1357 | KW_DELETE 1358 | : 'delete'; 1359 | 1360 | KW_FOREACH 1361 | : 'foreach'; 1362 | 1363 | KW_CONTINUE 1364 | : 'continue'; 1365 | 1366 | KW_RETURN 1367 | : 'return'; 1368 | 1369 | KW_BREAK 1370 | : 'break'; 1371 | 1372 | KW_VAR 1373 | : 'var'; 1374 | 1375 | KW_THROW 1376 | : 'throw'; 1377 | 1378 | KW_THIS 1379 | : 'this'; 1380 | 1381 | KW_BASE 1382 | : 'base'; 1383 | 1384 | KW_THROWS 1385 | : 'throws'; 1386 | 1387 | KW_REQUIRES 1388 | : 'requires'; 1389 | 1390 | KW_ENSURES 1391 | : 'ensures'; 1392 | 1393 | KW_DELEGATE 1394 | : 'delegate'; 1395 | 1396 | KW_SIGNAL 1397 | : 'signal'; 1398 | 1399 | KW_CONST 1400 | : 'const'; 1401 | 1402 | KW_DEFAULT 1403 | : 'default'; 1404 | 1405 | KW_IF 1406 | : 'if'; 1407 | 1408 | KW_ELSE 1409 | : 'else'; 1410 | 1411 | KW_SWITCH 1412 | : 'switch'; 1413 | 1414 | KW_CASE 1415 | : 'case'; 1416 | 1417 | KW_WHILE 1418 | : 'while'; 1419 | 1420 | KW_DO 1421 | : 'do'; 1422 | 1423 | KW_FOR 1424 | : 'for'; 1425 | 1426 | HEX 1427 | : 1428 | '0x' 1429 | (HEXDIGIT)+ 1430 | ; 1431 | 1432 | IDENTIFIER 1433 | : 1434 | ( '@' ( 'a'..'z' | 'A'..'Z' | '0'..'9' | '_')+ ) 1435 | 1436 | | 1437 | 1438 | ( 'a'..'z' | 'A'..'Z' | '_' ) 1439 | ( 'a'..'z' | 'A'..'Z' | '0'..'9' | '_')* 1440 | 1441 | | 1442 | 1443 | ('0'..'9')+ 1444 | (('a'..'z' | 'A'..'Z' | '_'))+ 1445 | ( 'a'..'z' | 'A'..'Z' | '0'..'9' | '_')* 1446 | ; 1447 | 1448 | VERBATIM_LITERAL 1449 | : 1450 | '"""' 1451 | (options {greedy=false;} : .)* 1452 | '"""' 1453 | ; 1454 | 1455 | STRING 1456 | : 1457 | '"' 1458 | ( 1459 | ESCAPE 1460 | | ~(BACKSLASH | QUOT) 1461 | )* 1462 | '"' 1463 | ; 1464 | 1465 | SHIFT_LEFT 1466 | : 1467 | '<<'; 1468 | 1469 | COMMA 1470 | : ','; 1471 | 1472 | SEMICOLON 1473 | : ';'; 1474 | 1475 | LBRACKET 1476 | : '['; 1477 | 1478 | RBRACKET 1479 | : ']'; 1480 | 1481 | LPAREN 1482 | : '('; 1483 | 1484 | RPAREN 1485 | : ')'; 1486 | 1487 | INCR_ASSIGN 1488 | : '+='; 1489 | 1490 | DECR_ASSIGN 1491 | : '-='; 1492 | 1493 | OR_ASSIGN 1494 | : '|='; 1495 | 1496 | AND_ASSIGN 1497 | : '&='; 1498 | 1499 | XOR_ASSIGN 1500 | : '^='; 1501 | 1502 | DIV_ASSIGN 1503 | : '/='; 1504 | 1505 | MUL_ASSIGN 1506 | : '*='; 1507 | 1508 | MOD_ASSIGN 1509 | : '%='; 1510 | 1511 | SHL_ASSIGN 1512 | : '<<='; 1513 | 1514 | fragment 1515 | SHR_ASSIGN 1516 | : ; // >>= 1517 | 1518 | fragment 1519 | GTEQ 1520 | : ; // >= 1521 | 1522 | GT 1523 | : 1524 | '>' 1525 | ( 1526 | ( 1527 | { input.LA(1) == '>' && input.LA(2) == '=' }?=> 1528 | ('>=' { $type = SHR_ASSIGN; /*System.out.println("SHR_ASSIGN!");*/ }) 1529 | ) 1530 | | 1531 | ( 1532 | { input.LA(1) == '=' }?=> 1533 | ('=' { $type = GTEQ; /*System.out.println("GTEQ!");*/ }) 1534 | ) 1535 | | 1536 | ({$type = GT; /*System.out.println("GT!");*/ }) 1537 | ); 1538 | 1539 | QUESTION 1540 | : '?'; 1541 | 1542 | COALESCE 1543 | : '??'; 1544 | 1545 | COLON 1546 | : ':'; 1547 | 1548 | BOOL_OR 1549 | : '||'; 1550 | 1551 | BOOL_AND 1552 | : '&&'; 1553 | 1554 | OR 1555 | : '|'; 1556 | 1557 | AND 1558 | : '&'; 1559 | 1560 | XOR 1561 | : '^'; 1562 | 1563 | EQUAL 1564 | : '=='; 1565 | 1566 | NOT_EQUAL 1567 | : '!='; 1568 | 1569 | LTEQ 1570 | : '<='; 1571 | 1572 | MULTIPLY 1573 | : '*'; 1574 | 1575 | PLUS 1576 | : '+'; 1577 | 1578 | MINUS 1579 | : '-'; 1580 | 1581 | DIV 1582 | : '/'; 1583 | 1584 | MOD 1585 | : '%'; 1586 | 1587 | NOT 1588 | : '!'; 1589 | 1590 | BITWISE_NOT 1591 | : '~'; 1592 | 1593 | INCREMENT 1594 | : '++'; 1595 | 1596 | DECREMENT 1597 | : '--'; 1598 | 1599 | POINTER_ACCESS 1600 | : '->'; 1601 | 1602 | LCURL 1603 | : '{'; 1604 | 1605 | RCURL 1606 | : '}'; 1607 | 1608 | TEMPLATE_START 1609 | : '@"'; 1610 | 1611 | QUOT 1612 | : '"'; 1613 | 1614 | LAMBDA 1615 | : '=>'; 1616 | 1617 | ELIPSIS 1618 | : '...'; 1619 | 1620 | LT : 1621 | '<' ; 1622 | 1623 | ASSIGNMENT 1624 | : 1625 | '='; 1626 | 1627 | fragment INTEGER : ; 1628 | fragment RANGE : ; 1629 | fragment DOT : '.'; 1630 | 1631 | REAL 1632 | : 1633 | DIGITS+ 1634 | ( 1635 | { 1636 | !((input.LA(2) >= 'a' && input.LA(2) <= 'z') 1637 | || (input.LA(2) >= 'A' && input.LA(2) <= 'Z')) 1638 | }?=> 1639 | DOT DIGITS? EXPONENT? ('d' | 'D' | 'f' | 'F')? 1640 | ( 1641 | { $type = REAL; } 1642 | ) 1643 | | 1644 | ( 1645 | EXPONENT 1646 | { $type = REAL; } 1647 | | 1648 | { $type = INTEGER; } 1649 | ) 1650 | ) 1651 | | 1652 | DIGITS 1653 | ('d' | 'D' | 'f' | 'F') 1654 | { $type = REAL; } 1655 | | 1656 | 1657 | DOT 1658 | ( 1659 | { 1660 | !((input.LA(-2) >= 'a' && input.LA(-2) <= 'z') 1661 | || (input.LA(-2) >= 'A' && input.LA(-2) <= 'Z')) 1662 | }?=> 1663 | ( 1664 | DIGITS EXPONENT? ('d' | 'D' | 'f' | 'F')? 1665 | { $type = REAL; } 1666 | ) 1667 | | 1668 | DOT 1669 | { $type = RANGE; } 1670 | | 1671 | { $type = DOT; } 1672 | ) 1673 | ; 1674 | 1675 | fragment 1676 | DIGITS 1677 | : ('0'..'9')+ 1678 | ; 1679 | 1680 | CHAR 1681 | : '\'' ( ESCAPE | ~('\'' | BACKSLASH) ) '\'' 1682 | ; 1683 | 1684 | LINE_COMMAND 1685 | : 1686 | ('#' 1687 | ~('\n'|'\r')* 1688 | '\r'? 1689 | '\n') 1690 | {$channel=HIDDEN;} 1691 | ; 1692 | 1693 | fragment 1694 | EXPONENT : ('e'|'E') ('+'|'-')? ('0'..'9')+ ; 1695 | 1696 | fragment 1697 | HEXDIGIT : ('0'..'9'|'a'..'f'|'A'..'F') ; 1698 | 1699 | fragment 1700 | ESCAPE 1701 | : BACKSLASH ('b'|'t'|'n'|'f'|'r'|'\"'|'\''|BACKSLASH) 1702 | | UNICODE 1703 | | OCTAL 1704 | ; 1705 | 1706 | fragment 1707 | OCTAL 1708 | : BACKSLASH ('0'..'3') ('0'..'7') ('0'..'7') 1709 | | BACKSLASH ('0'..'7') ('0'..'7') 1710 | | BACKSLASH ('0'..'7') 1711 | ; 1712 | 1713 | fragment 1714 | UNICODE 1715 | : BACKSLASH 'u' HEXDIGIT HEXDIGIT HEXDIGIT HEXDIGIT 1716 | ; 1717 | 1718 | GLOBAL_NS 1719 | : 1720 | 'global::'; 1721 | 1722 | BACKSLASH 1723 | : '\\'; 1724 | 1725 | UNICODE_CHAR 1726 | : '\u0024' | 1727 | '\u0041'..'\u005a' | 1728 | '\u005f' | 1729 | '\u0061'..'\u007a' | 1730 | '\u00c0'..'\u00d6' | 1731 | '\u00d8'..'\u00f6' | 1732 | '\u00f8'..'\u00ff' | 1733 | '\u0100'..'\u1fff' | 1734 | '\u3040'..'\u318f' | 1735 | '\u3300'..'\u337f' | 1736 | '\u3400'..'\u3d2d' | 1737 | '\u4e00'..'\u9fff' | 1738 | '\uf900'..'\ufaff' | 1739 | '\u0030'..'\u0039' | 1740 | '\u0660'..'\u0669' | 1741 | '\u06f0'..'\u06f9' | 1742 | '\u0966'..'\u096f' | 1743 | '\u09e6'..'\u09ef' | 1744 | '\u0a66'..'\u0a6f' | 1745 | '\u0ae6'..'\u0aef' | 1746 | '\u0b66'..'\u0b6f' | 1747 | '\u0be7'..'\u0bef' | 1748 | '\u0c66'..'\u0c6f' | 1749 | '\u0ce6'..'\u0cef' | 1750 | '\u0d66'..'\u0d6f' | 1751 | '\u0e50'..'\u0e59' | 1752 | '\u0ed0'..'\u0ed9' | 1753 | '\u1040'..'\u1049' 1754 | ; 1755 | 1756 | OTHER_CHAR 1757 | : ~UNICODE_CHAR; 1758 | 1759 | 1760 | // todo: implement regular expressions 1761 | REGEX_LITERAL 1762 | : 1763 | '/--this-is-not-complete-yet--' 1764 | { 1765 | input.LA(-1) == '/' 1766 | }?=> 1767 | (~('/') 1768 | | '\\/')+ 1769 | '/' 1770 | ('g'|'m'|'i')*; 1771 | -------------------------------------------------------------------------------- /antlr/TestParser/nbproject/build-impl.xml: -------------------------------------------------------------------------------- 1 | 2 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 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 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | Must set src.dir 186 | Must set test.src.dir 187 | Must set build.dir 188 | Must set dist.dir 189 | Must set build.classes.dir 190 | Must set dist.javadoc.dir 191 | Must set build.test.classes.dir 192 | Must set build.test.results.dir 193 | Must set build.classes.excludes 194 | Must set dist.jar 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 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 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | Must set javac.includes 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 | 329 | 330 | 331 | 332 | 333 | 334 | 335 | 336 | 337 | 338 | 339 | 340 | 341 | 342 | 343 | 344 | 345 | 346 | 347 | 348 | 349 | 350 | 351 | 352 | 353 | 354 | 355 | 356 | 357 | 358 | 359 | 360 | 361 | 362 | 363 | 364 | 365 | 366 | 367 | 368 | 369 | 370 | 371 | 372 | 373 | 374 | 375 | 376 | 377 | 378 | 379 | 380 | 381 | 382 | 383 | 384 | 385 | 386 | 387 | 388 | 389 | 390 | 391 | 392 | 393 | 394 | 395 | 396 | 397 | 398 | 399 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 419 | 420 | 421 | 422 | 423 | 424 | 425 | 426 | 427 | 428 | 429 | 430 | 431 | 432 | 433 | 434 | 435 | 436 | 437 | 438 | 439 | 440 | 441 | 442 | 443 | 444 | 445 | 446 | 447 | 448 | 449 | 450 | 451 | 452 | 453 | 454 | 455 | 456 | 457 | 458 | 459 | 460 | 461 | 462 | 463 | 464 | 465 | 466 | 467 | 468 | 469 | 470 | 471 | 472 | 473 | 474 | 475 | 476 | 477 | 478 | 479 | 480 | 481 | 482 | 483 | 484 | 485 | 486 | 487 | 492 | 493 | 494 | 495 | 496 | 497 | 498 | 499 | 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 509 | 510 | 511 | 512 | 513 | 514 | 515 | 516 | 517 | 518 | 519 | 520 | 521 | 522 | 523 | 524 | 525 | 526 | 527 | 528 | 529 | 530 | 531 | 532 | 533 | 534 | 535 | 536 | 537 | 538 | 539 | 540 | 541 | 542 | 543 | 544 | 545 | 546 | 547 | 548 | 549 | 550 | 551 | 552 | Must select some files in the IDE or set javac.includes 553 | 554 | 555 | 556 | 557 | 558 | 559 | 560 | 561 | 566 | 567 | 568 | 569 | 570 | 571 | 572 | 573 | 574 | 575 | 576 | 577 | 578 | 579 | 580 | 581 | 582 | 583 | 584 | 585 | 586 | To run this application from the command line without Ant, try: 587 | 588 | 589 | 590 | 591 | 592 | 593 | java -cp "${run.classpath.with.dist.jar}" ${main.class} 594 | 595 | 596 | 597 | 598 | 599 | 600 | 601 | 602 | 603 | 604 | 605 | To run this application from the command line without Ant, try: 606 | 607 | java -jar "${dist.jar.resolved}" 608 | 609 | 610 | 611 | 612 | 613 | 614 | 615 | To run this application from the command line without Ant, try: 616 | 617 | java -jar "${dist.jar.resolved}" 618 | 619 | 620 | 621 | 622 | 623 | 624 | 629 | 630 | 631 | 632 | 633 | 634 | 635 | 636 | 637 | 638 | 639 | 640 | Must select one file in the IDE or set run.class 641 | 642 | 643 | 644 | Must select one file in the IDE or set run.class 645 | 646 | 647 | 652 | 653 | 654 | 655 | 656 | 657 | 658 | 659 | 660 | 661 | 662 | 663 | 664 | 665 | 666 | 667 | 668 | 669 | 670 | 671 | Must select one file in the IDE or set debug.class 672 | 673 | 674 | 675 | 676 | Must select one file in the IDE or set debug.class 677 | 678 | 679 | 680 | 681 | Must set fix.includes 682 | 683 | 684 | 685 | 686 | 687 | 688 | 693 | 694 | 695 | 696 | 697 | 698 | 699 | 700 | 701 | 702 | 703 | 704 | 705 | 706 | 707 | 708 | 709 | 710 | 711 | 712 | 713 | 714 | 715 | 716 | 717 | 718 | 719 | 724 | 725 | 726 | 727 | 728 | 729 | 730 | 731 | 732 | 733 | 734 | 735 | 736 | 737 | 738 | 739 | 740 | 741 | 742 | 743 | 744 | 745 | 746 | 747 | 748 | 749 | 750 | Must select some files in the IDE or set javac.includes 751 | 752 | 753 | 754 | 755 | 756 | 757 | 758 | 759 | 760 | 761 | 762 | 767 | 768 | 769 | 770 | 771 | 772 | 773 | 774 | Some tests failed; see details above. 775 | 776 | 777 | 778 | 779 | 780 | 781 | 782 | 783 | Must select some files in the IDE or set test.includes 784 | 785 | 786 | 787 | Some tests failed; see details above. 788 | 789 | 790 | 795 | 796 | Must select one file in the IDE or set test.class 797 | 798 | 799 | 800 | 801 | 802 | 803 | 804 | 805 | 806 | 807 | 808 | 809 | 810 | 811 | 812 | 813 | 814 | 815 | 816 | 817 | 818 | 819 | 820 | 821 | 826 | 827 | Must select one file in the IDE or set applet.url 828 | 829 | 830 | 831 | 832 | 833 | 834 | 839 | 840 | Must select one file in the IDE or set applet.url 841 | 842 | 843 | 844 | 845 | 846 | 847 | 848 | 853 | 854 | 855 | 856 | 857 | 858 | 859 | 860 | 861 | 862 | 863 | 864 | 865 | 866 | 867 | 868 | 869 | 870 | 871 | 872 | 873 | 874 | 875 | 876 | 877 | 878 | 879 | 880 | 881 | 882 | 883 | 884 | 885 | 886 | 887 | 888 | 889 | 890 | 891 | 892 | 893 | 894 | 895 | --------------------------------------------------------------------------------