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}")
===
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
#!/usr/bin/env kotlin
|
||||
|
||||
println(args)
|
||||
@@ -0,0 +1,14 @@
|
||||
JetFile: Shebang.ktscript
|
||||
PsiComment(SHEBANG_COMMENT)('#!/usr/bin/env kotlin')
|
||||
PsiWhiteSpace('\n\n')
|
||||
SCRIPT
|
||||
BLOCK
|
||||
CALL_EXPRESSION
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('println')
|
||||
VALUE_ARGUMENT_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
VALUE_ARGUMENT
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('args')
|
||||
PsiElement(RPAR)(')')
|
||||
@@ -0,0 +1,3 @@
|
||||
println(1); #!/usr
|
||||
|
||||
#!/hi
|
||||
@@ -0,0 +1,35 @@
|
||||
JetFile: ShebangIncorrect.ktscript
|
||||
SCRIPT
|
||||
BLOCK
|
||||
CALL_EXPRESSION
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('println')
|
||||
VALUE_ARGUMENT_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
VALUE_ARGUMENT
|
||||
INTEGER_CONSTANT
|
||||
PsiElement(INTEGER_LITERAL)('1')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiElement(SEMICOLON)(';')
|
||||
PsiWhiteSpace(' ')
|
||||
BINARY_EXPRESSION
|
||||
TUPLE
|
||||
PsiElement(HASH)('#')
|
||||
PsiElement(EXCL)('!')
|
||||
PsiErrorElement:Expecting an expression
|
||||
<empty list>
|
||||
OPERATION_REFERENCE
|
||||
PsiElement(DIV)('/')
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('usr')
|
||||
PsiWhiteSpace('\n\n')
|
||||
BINARY_EXPRESSION
|
||||
TUPLE
|
||||
PsiElement(HASH)('#')
|
||||
PsiElement(EXCL)('!')
|
||||
PsiErrorElement:Expecting an expression
|
||||
<empty list>
|
||||
OPERATION_REFERENCE
|
||||
PsiElement(DIV)('/')
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('hi')
|
||||
Reference in New Issue
Block a user