@octopusdeploy/ocl
Advanced tools
Comparing version 0.0.1 to 0.0.2
@@ -18,2 +18,4 @@ import type { Token } from "./token"; | ||
HEREDOC = "heredoc", | ||
TRUE = "true", | ||
FALSE = "false", | ||
INDENTED_HEREDOC = "indentedHeredoc" | ||
@@ -29,2 +31,3 @@ } | ||
children: AST; | ||
type: NodeType.ATTRIBUTE_NODE; | ||
assignmentOp: Token; | ||
@@ -55,2 +58,3 @@ name: Token; | ||
children: AST; | ||
type: NodeType.BLOCK_NODE; | ||
name: Token; | ||
@@ -57,0 +61,0 @@ lables?: LiteralNode[]; |
@@ -20,4 +20,6 @@ "use strict"; | ||
LiteralType["HEREDOC"] = "heredoc"; | ||
LiteralType["TRUE"] = "true"; | ||
LiteralType["FALSE"] = "false"; | ||
LiteralType["INDENTED_HEREDOC"] = "indentedHeredoc"; | ||
})(LiteralType = exports.LiteralType || (exports.LiteralType = {})); | ||
//# sourceMappingURL=ast.js.map |
@@ -50,2 +50,6 @@ "use strict"; | ||
} | ||
case '\r': { | ||
this.nextChar(); | ||
return this.tokenizeCurrentChar(token_1.TokenType.NEW_LINE); | ||
} | ||
case '{': { | ||
@@ -74,3 +78,3 @@ return this.tokenizeCurrentChar(token_1.TokenType.OPEN_BRACKET); | ||
var value = ''; | ||
while (!['EOF', '\n', ' ', '"', '=', '{', '}', '[', ']', '\'', ','].includes(this.currentChar)) { | ||
while (!['EOF', '\n', '\r', ' ', '"', '=', '{', '}', '[', ']', '\'', ','].includes(this.currentChar)) { | ||
value += this.currentChar; | ||
@@ -123,7 +127,11 @@ this.nextChar(); | ||
} | ||
if (char === ' ' || char === '\n') { | ||
if (char === ' ' || char === '\n' || char === '\r') { | ||
if (char === '\r') { | ||
this.nextChar(); | ||
char = this.currentChar; | ||
} | ||
return this.tokenizeValue(value, tokenType, "Expected Heredoc tag; Got whitespace"); | ||
} | ||
var tag = ''; | ||
while (![' ', '\n'].includes(this.currentChar)) { | ||
while (![' ', '\n', '\r'].includes(this.currentChar)) { | ||
tag += this.currentChar; | ||
@@ -133,3 +141,3 @@ value += this.currentChar; | ||
} | ||
while (this.currentChar === ' ') { | ||
while (this.currentChar === ' ' || this.currentChar === '\r') { | ||
this.nextChar(); | ||
@@ -139,3 +147,3 @@ } | ||
if (char !== '\n') { | ||
return this.tokenizeValue(value, tokenType, "Expected \\\\n; Got " + char); | ||
return this.tokenizeValue(value, tokenType, "Expected new line; Got " + char); | ||
} | ||
@@ -147,3 +155,3 @@ value += this.currentChar; | ||
var currentLn = ''; | ||
while (!['\n', 'EOF'].includes(this.currentChar)) { | ||
while (!['\n', '\r', 'EOF'].includes(this.currentChar)) { | ||
value += this.currentChar; | ||
@@ -150,0 +158,0 @@ currentLn += this.currentChar; |
@@ -107,3 +107,11 @@ "use strict"; | ||
default: { | ||
value = this.handleRecoveryNode('Unexpected token. Expected literal, dictionary or array after assignment operator.', this.currentToken); | ||
if (this.currentToken.value === 'true') { | ||
value = this.handleLiteralNode(ast_1.LiteralType.TRUE); | ||
} | ||
else if (this.currentToken.value === 'false') { | ||
value = this.handleLiteralNode(ast_1.LiteralType.FALSE); | ||
} | ||
else { | ||
value = this.handleRecoveryNode('Unexpected token. Expected literal, dictionary or array after assignment operator.', this.currentToken); | ||
} | ||
break; | ||
@@ -145,10 +153,12 @@ } | ||
var entries = []; | ||
while (this.currentToken.tokenType !== token_1.TokenType.CLOSE_BRACKET) { | ||
while (this.peekToken().tokenType !== token_1.TokenType.CLOSE_BRACKET) { | ||
if (this.currentToken.tokenType === token_1.TokenType.SYMBOL) { | ||
entries.push(this.handleAttribute()); | ||
} | ||
this.nextToken(); | ||
else { | ||
this.nextToken(); | ||
} | ||
} | ||
this.nextToken(); | ||
var blockEnd = this.currentToken; | ||
this.nextToken(); | ||
var dictionaryNode = { | ||
@@ -223,3 +233,3 @@ children: entries, | ||
var block = []; | ||
while (this.peekToken().tokenType !== token_1.TokenType.CLOSE_BRACKET) { | ||
while (![token_1.TokenType.CLOSE_BRACKET, token_1.TokenType.EOF].includes(this.peekToken().tokenType)) { | ||
block.push(this.nextNode()); | ||
@@ -226,0 +236,0 @@ } |
@@ -15,6 +15,8 @@ { | ||
"ts-jest": "^27.0.7", | ||
"ts-node": "^10.3.0", | ||
"ts-node-dev": "^1.1.8", | ||
"typescript": "^4.4.4" | ||
}, | ||
"files": ["dist/**/*"], | ||
"files": [ | ||
"dist/**/*" | ||
], | ||
"homepage": "https://github.com/OctopusDeploy/ocl.ts#readme", | ||
@@ -39,7 +41,7 @@ "keywords": [ | ||
"prepare": "npm run build", | ||
"start": "ts-node ./src/main.ts", | ||
"start": "ts-node-dev ./src/main.ts", | ||
"test": "jest" | ||
}, | ||
"types": "dist/index.d.ts", | ||
"version": "0.0.1" | ||
"version": "0.0.2" | ||
} |
@@ -1,3 +0,3 @@ | ||
# OCL.TS | ||
# ocl.ts | ||
This library is used to process Octopus Configuration Language (OCL) (see [syntax](https://github.com/OctopusDeploy/ocl#syntax) for more information). |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
41443
682