Commit Graph

27 Commits

Author SHA1 Message Date
Ilya Chernikov 7bb9f97b11 Allow to separate top-level script declarations and statements with semicolon
This fix allows to write one-liner scripts like "val x = 3; println(x)", which
were previously rejected by the parser.
2019-12-02 16:46:54 +01:00
Nikolay Krasko 7d66af6583 Always assign shebang comment to same position before package 2017-08-07 12:17:20 +03:00
Nikolay Krasko 8d226594ff Put comments and whitespaces under body in script files
It's more consistent to normal function body for IDE.
Doc comments in file beginning are now sticks to declarations
correctly.
Moving declarations at the end of scripts is fixed
2017-08-07 12:17:17 +03:00
Nikolay Krasko 0cd3e4f3a4 Minor: JetFile -> KtFile 2017-05-18 20:00:17 +03:00
Dmitry Petrov a974ed1049 Support custom accessors for top-level properties in scripts. 2017-01-26 10:12:13 +03:00
Denis Zharkov fcb870a303 Add EOL to EXPRESSION_FOLLOW recovery set
This change is used in further commits, but it's extracted
to emphasize that testData modifications are caused by this.
2016-07-15 18:27:00 +03:00
Evgeny Gerashchenko c242ad94fd Minor. Syntax error cosmetics. 2016-01-29 01:00:47 +03:00
Pavel V. Talanov dbd49c37c1 Psi: Introduce KtScriptInitializer, a separate entity for script initializers which are quite a bit different from class initializers 2015-11-19 22:57:07 +03:00
Pavel V. Talanov daa1a08213 Script refactoring, parser: wrap statements in script as if they are init blocks of a class 2015-11-19 22:56:54 +03:00
Yan Zhulanow 2bacbc9046 Support @field: annotations 2015-08-31 15:05:02 +03:00
Dmitry Jemerov 0295b13cc7 couple more tuple leftovers 2015-07-14 17:14:33 +02:00
Dmitry Jemerov 55c11539f8 drop tuples support from parser 2015-07-14 17:06:17 +02:00
Denis Zharkov cf4b1ab7cd Drop obsolete annotations syntax 2015-06-12 09:55:00 +03:00
Pavel V. Talanov 07d35d305e Create import list psi element even if no directives are present
Fix a problem where deleting last import directive via "optimize imports" could lead to incorrect psi structure resulting in CCE, see EA-64291
New imports are inserted at the head (after package directive if present) of the file (before any comments) if no imports were present
Add test for inserting import to file where a first statement is a comment
Drop code dealing with non-existing import list in ImportInsertHelperImpl
AbstractQuickFixTest: check for unexpected actions before changes to the file are made as it relies on the first line having specific format
2015-06-08 20:51:04 +03:00
Alexander Udalov 102f0d3470 Regenerate .txt testData
Add newline to EOF, trim trailing spaces
2014-10-21 00:16:08 +04:00
Zalim Bashorov 3c60d0de93 Parser: added the support file annotations. 2014-09-10 22:39:11 +04:00
Natalia Ukhorskaya 0677075335 Parser for JetBlockCodeFragment 2014-05-15 13:54:25 +04:00
Andrey Breslav d5eea09146 Imports moved from under the script node to top level 2014-04-01 12:36:52 +04:00
Ilya Ryzhenkov 98c54f39bb Unify script file extensions to "kts" so that IDEA, compiler and tests agree when to parse as SCRIPT.
Include kt* files into formatter test generation, to test scripting formatting
2014-03-24 18:17:50 +04:00
Pavel V. Talanov 24364dd63b Get rid of JetNodeTypes#LOOP_PARAMETER 2014-03-24 17:05:58 +04:00
Evgeny Gerashchenko 791b5bb84c JetNamespaceHeader → JetPackageDirective. 2014-01-14 18:06:48 +04:00
Evgeny Gerashchenko 84bc74894a Always parsing tuples as errors. 2013-03-22 16:37:16 +04:00
Alex Tkachman e134969896 making script classes useful/accessable for the rest of the world 2012-08-01 09:58:01 +03:00
Andrey Breslav bf503e9a4b KT-2363 Drop secondary constructors
#KT-2363 Fixed
2012-07-19 19:53:06 +04:00
Stepan Koltsov 4d06660243 parse imports in scripts 2012-06-13 22:32:36 +04:00
Stepan Koltsov 25f71bcd3a skip shebang in the first line
Something like this works now:

===
% PATH="./bin:$PATH" ./sum.ktscript 31 21
31 + 21 = 52

% cat sum.ktscript
#!/usr/bin/env kotlin -script

val a = Integer.parseInt(args[0])
val b = Integer.parseInt(args[1])
println("$a + $b = ${a + b}")
===
2012-05-28 22:59:03 +04:00
Stepan Koltsov 5fc73a4cd4 parse kotlin scripts
http://confluence.jetbrains.net/display/~stepan.koltsov/REPL
2012-05-23 02:52:29 +04:00