How to use the yaml-ast-parser.determineScalarType function in yaml-ast-parser

To help you get started, we’ve selected a few yaml-ast-parser examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github threadheap / serverless-ide-vscode / packages / language-server / src / language-service / parser / json / document.ts View on Github external
parent,
									null,
									instance.endPosition,
									instance.endPosition
							  )
							: this.recursivelyBuildAst(result, item)

					itemNode.location = count++
					result.addItem(itemNode)
				}

				return result
			}
			case Yaml.Kind.SCALAR: {
				const instance = node as YamlScalar
				const type = Yaml.determineScalarType(instance)

				// The name is set either by the sequence or the mapping case.
				const name = null
				const value = instance.value

				// This is a patch for redirecting values with these strings to be boolean nodes because its not supported in the parser.
				const possibleBooleanValues = [
					"y",
					"Y",
					"yes",
					"Yes",
					"YES",
					"n",
					"N",
					"no",
					"No",
github alibaba / serverless-vscode / src / parser / parser.ts View on Github external
for (const item of instance.items) {
        const itemNode =
          item === null
            ? new NullASTNode(
              parent,
              instance.endPosition,
              instance.endPosition,
            )
            : buildAstRecursively(result, item);
        result.addItem(itemNode);
      }
      return result;
    }
    case Yaml.Kind.SCALAR: {
      const instance = node as Yaml.YAMLScalar;
      const type = Yaml.determineScalarType(instance);
      const value = instance.value;
      switch (type) {
        case Yaml.ScalarType.null: {
          return new StringASTNode(
            parent,
            false,
            instance.startPosition,
            instance.endPosition,
          );
        }
        case Yaml.ScalarType.bool: {
          return new BooleanASTNode(
            parent,
            Yaml.parseYamlBoolean(value),
            instance.startPosition,
            instance.endPosition,