diff --git a/semgrep_output_v1.atd b/semgrep_output_v1.atd index 3a4c987c..3eaf7c99 100644 --- a/semgrep_output_v1.atd +++ b/semgrep_output_v1.atd @@ -511,6 +511,7 @@ type error_type * *) | PatternParseError0 | IncompatibleRule0 + | DependencyResolutionError of resolution_error ] type incompatible_rule @@ -1840,6 +1841,7 @@ type manifest = { } type resolution_error + = [ | UnsupportedManifest | MissingRequirement of string @@ -1848,6 +1850,7 @@ type resolution_error ] type resolution_cmd_failed + = { command: string; message: string; diff --git a/semgrep_output_v1.jsonschema b/semgrep_output_v1.jsonschema index 3fe1b33b..a1c45461 100644 --- a/semgrep_output_v1.jsonschema +++ b/semgrep_output_v1.jsonschema @@ -328,7 +328,16 @@ ] }, { "const": "Pattern parse error" }, - { "const": "Incompatible rule" } + { "const": "Incompatible rule" }, + { + "type": "array", + "minItems": 2, + "items": false, + "prefixItems": [ + { "const": "DependencyResolutionError" }, + { "$ref": "#/definitions/resolution_error" } + ] + } ] }, "incompatible_rule": { diff --git a/semgrep_output_v1.proto b/semgrep_output_v1.proto index 2691e11c..82ad8ca9 100644 --- a/semgrep_output_v1.proto +++ b/semgrep_output_v1.proto @@ -1,6 +1,6 @@ // Generated by jsonschema2protobuf. DO NOT EDIT! // Source file: semgrep_output_v1.jsonschema -// Source file sha256 digest: 4bb6682721c4e0a4f5791f7e2c8d48932b22edd16c3328d061e9f193658d6d0a +// Source file sha256 digest: 9a11c906ecdceafccb06459b407c58809d63f5c678aa5a3ff319c7e30418dcc2 syntax = "proto3"; diff --git a/semgrep_output_v1.py b/semgrep_output_v1.py index bbe9c8dc..a7a26d17 100644 --- a/semgrep_output_v1.py +++ b/semgrep_output_v1.py @@ -4652,6 +4652,147 @@ def to_json_string(self, **kw: Any) -> str: return json.dumps(self.to_json(), **kw) +@dataclass(frozen=True) +class ResolutionCmdFailed: + """Original type: resolution_cmd_failed = { ... }""" + + command: str + message: str + + @classmethod + def from_json(cls, x: Any) -> 'ResolutionCmdFailed': + if isinstance(x, dict): + return cls( + command=_atd_read_string(x['command']) if 'command' in x else _atd_missing_json_field('ResolutionCmdFailed', 'command'), + message=_atd_read_string(x['message']) if 'message' in x else _atd_missing_json_field('ResolutionCmdFailed', 'message'), + ) + else: + _atd_bad_json('ResolutionCmdFailed', x) + + def to_json(self) -> Any: + res: Dict[str, Any] = {} + res['command'] = _atd_write_string(self.command) + res['message'] = _atd_write_string(self.message) + return res + + @classmethod + def from_json_string(cls, x: str) -> 'ResolutionCmdFailed': + return cls.from_json(json.loads(x)) + + def to_json_string(self, **kw: Any) -> str: + return json.dumps(self.to_json(), **kw) + + +@dataclass(frozen=True) +class UnsupportedManifest: + """Original type: resolution_error = [ ... | UnsupportedManifest | ... ]""" + + @property + def kind(self) -> str: + """Name of the class representing this variant.""" + return 'UnsupportedManifest' + + @staticmethod + def to_json() -> Any: + return 'UnsupportedManifest' + + def to_json_string(self, **kw: Any) -> str: + return json.dumps(self.to_json(), **kw) + + +@dataclass(frozen=True) +class MissingRequirement: + """Original type: resolution_error = [ ... | MissingRequirement of ... | ... ]""" + + value: str + + @property + def kind(self) -> str: + """Name of the class representing this variant.""" + return 'MissingRequirement' + + def to_json(self) -> Any: + return ['MissingRequirement', _atd_write_string(self.value)] + + def to_json_string(self, **kw: Any) -> str: + return json.dumps(self.to_json(), **kw) + + +@dataclass(frozen=True) +class ResolutionCmdFailed_: + """Original type: resolution_error = [ ... | ResolutionCmdFailed of ... | ... ]""" + + value: ResolutionCmdFailed + + @property + def kind(self) -> str: + """Name of the class representing this variant.""" + return 'ResolutionCmdFailed_' + + def to_json(self) -> Any: + return ['ResolutionCmdFailed', (lambda x: x.to_json())(self.value)] + + def to_json_string(self, **kw: Any) -> str: + return json.dumps(self.to_json(), **kw) + + +@dataclass(frozen=True) +class ParseDependenciesFailed: + """Original type: resolution_error = [ ... | ParseDependenciesFailed of ... | ... ]""" + + value: str + + @property + def kind(self) -> str: + """Name of the class representing this variant.""" + return 'ParseDependenciesFailed' + + def to_json(self) -> Any: + return ['ParseDependenciesFailed', _atd_write_string(self.value)] + + def to_json_string(self, **kw: Any) -> str: + return json.dumps(self.to_json(), **kw) + + +@dataclass(frozen=True) +class ResolutionError: + """Original type: resolution_error = [ ... ]""" + + value: Union[UnsupportedManifest, MissingRequirement, ResolutionCmdFailed_, ParseDependenciesFailed] + + @property + def kind(self) -> str: + """Name of the class representing this variant.""" + return self.value.kind + + @classmethod + def from_json(cls, x: Any) -> 'ResolutionError': + if isinstance(x, str): + if x == 'UnsupportedManifest': + return cls(UnsupportedManifest()) + _atd_bad_json('ResolutionError', x) + if isinstance(x, List) and len(x) == 2: + cons = x[0] + if cons == 'MissingRequirement': + return cls(MissingRequirement(_atd_read_string(x[1]))) + if cons == 'ResolutionCmdFailed': + return cls(ResolutionCmdFailed_(ResolutionCmdFailed.from_json(x[1]))) + if cons == 'ParseDependenciesFailed': + return cls(ParseDependenciesFailed(_atd_read_string(x[1]))) + _atd_bad_json('ResolutionError', x) + _atd_bad_json('ResolutionError', x) + + def to_json(self) -> Any: + return self.value.to_json() + + @classmethod + def from_json_string(cls, x: str) -> 'ResolutionError': + return cls.from_json(json.loads(x)) + + def to_json_string(self, **kw: Any) -> str: + return json.dumps(self.to_json(), **kw) + + @dataclass(frozen=True) class IncompatibleRule: """Original type: incompatible_rule = { ... }""" @@ -5119,11 +5260,29 @@ def to_json_string(self, **kw: Any) -> str: return json.dumps(self.to_json(), **kw) +@dataclass(frozen=True, order=True) +class DependencyResolutionError: + """Original type: error_type = [ ... | DependencyResolutionError of ... | ... ]""" + + value: ResolutionError + + @property + def kind(self) -> str: + """Name of the class representing this variant.""" + return 'DependencyResolutionError' + + def to_json(self) -> Any: + return ['DependencyResolutionError', (lambda x: x.to_json())(self.value)] + + def to_json_string(self, **kw: Any) -> str: + return json.dumps(self.to_json(), **kw) + + @dataclass(frozen=True, order=True) class ErrorType: """Original type: error_type = [ ... ]""" - value: Union[LexicalError, ParseError, OtherParseError, AstBuilderError, RuleParseError, SemgrepWarning, SemgrepError, InvalidRuleSchemaError, UnknownLanguageError, InvalidYaml, MatchingError, SemgrepMatchFound, TooManyMatches_, FatalError, Timeout, OutOfMemory, StackOverflow, TimeoutDuringInterfile, OutOfMemoryDuringInterfile, MissingPlugin, PatternParseError, PartialParsing, IncompatibleRule_, PatternParseError0, IncompatibleRule0] + value: Union[LexicalError, ParseError, OtherParseError, AstBuilderError, RuleParseError, SemgrepWarning, SemgrepError, InvalidRuleSchemaError, UnknownLanguageError, InvalidYaml, MatchingError, SemgrepMatchFound, TooManyMatches_, FatalError, Timeout, OutOfMemory, StackOverflow, TimeoutDuringInterfile, OutOfMemoryDuringInterfile, MissingPlugin, PatternParseError, PartialParsing, IncompatibleRule_, PatternParseError0, IncompatibleRule0, DependencyResolutionError] @property def kind(self) -> str: @@ -5186,6 +5345,8 @@ def from_json(cls, x: Any) -> 'ErrorType': return cls(PartialParsing(_atd_read_list(Location.from_json)(x[1]))) if cons == 'IncompatibleRule': return cls(IncompatibleRule_(IncompatibleRule.from_json(x[1]))) + if cons == 'DependencyResolutionError': + return cls(DependencyResolutionError(ResolutionError.from_json(x[1]))) _atd_bad_json('ErrorType', x) _atd_bad_json('ErrorType', x) @@ -5656,147 +5817,6 @@ def to_json_string(self, **kw: Any) -> str: return json.dumps(self.to_json(), **kw) -@dataclass(frozen=True) -class ResolutionCmdFailed: - """Original type: resolution_cmd_failed = { ... }""" - - command: str - message: str - - @classmethod - def from_json(cls, x: Any) -> 'ResolutionCmdFailed': - if isinstance(x, dict): - return cls( - command=_atd_read_string(x['command']) if 'command' in x else _atd_missing_json_field('ResolutionCmdFailed', 'command'), - message=_atd_read_string(x['message']) if 'message' in x else _atd_missing_json_field('ResolutionCmdFailed', 'message'), - ) - else: - _atd_bad_json('ResolutionCmdFailed', x) - - def to_json(self) -> Any: - res: Dict[str, Any] = {} - res['command'] = _atd_write_string(self.command) - res['message'] = _atd_write_string(self.message) - return res - - @classmethod - def from_json_string(cls, x: str) -> 'ResolutionCmdFailed': - return cls.from_json(json.loads(x)) - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass(frozen=True) -class UnsupportedManifest: - """Original type: resolution_error = [ ... | UnsupportedManifest | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'UnsupportedManifest' - - @staticmethod - def to_json() -> Any: - return 'UnsupportedManifest' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass(frozen=True) -class MissingRequirement: - """Original type: resolution_error = [ ... | MissingRequirement of ... | ... ]""" - - value: str - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'MissingRequirement' - - def to_json(self) -> Any: - return ['MissingRequirement', _atd_write_string(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass(frozen=True) -class ResolutionCmdFailed_: - """Original type: resolution_error = [ ... | ResolutionCmdFailed of ... | ... ]""" - - value: ResolutionCmdFailed - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'ResolutionCmdFailed_' - - def to_json(self) -> Any: - return ['ResolutionCmdFailed', (lambda x: x.to_json())(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass(frozen=True) -class ParseDependenciesFailed: - """Original type: resolution_error = [ ... | ParseDependenciesFailed of ... | ... ]""" - - value: str - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'ParseDependenciesFailed' - - def to_json(self) -> Any: - return ['ParseDependenciesFailed', _atd_write_string(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass(frozen=True) -class ResolutionError: - """Original type: resolution_error = [ ... ]""" - - value: Union[UnsupportedManifest, MissingRequirement, ResolutionCmdFailed_, ParseDependenciesFailed] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return self.value.kind - - @classmethod - def from_json(cls, x: Any) -> 'ResolutionError': - if isinstance(x, str): - if x == 'UnsupportedManifest': - return cls(UnsupportedManifest()) - _atd_bad_json('ResolutionError', x) - if isinstance(x, List) and len(x) == 2: - cons = x[0] - if cons == 'MissingRequirement': - return cls(MissingRequirement(_atd_read_string(x[1]))) - if cons == 'ResolutionCmdFailed': - return cls(ResolutionCmdFailed_(ResolutionCmdFailed.from_json(x[1]))) - if cons == 'ParseDependenciesFailed': - return cls(ParseDependenciesFailed(_atd_read_string(x[1]))) - _atd_bad_json('ResolutionError', x) - _atd_bad_json('ResolutionError', x) - - def to_json(self) -> Any: - return self.value.to_json() - - @classmethod - def from_json_string(cls, x: str) -> 'ResolutionError': - return cls.from_json(json.loads(x)) - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - @dataclass class ResolutionOk: """Original type: resolution_result = [ ... | ResolutionOk of ... | ... ]""" diff --git a/semgrep_output_v1.ts b/semgrep_output_v1.ts index 9083287d..fec198fb 100644 --- a/semgrep_output_v1.ts +++ b/semgrep_output_v1.ts @@ -192,6 +192,7 @@ export type ErrorType = | { kind: 'IncompatibleRule'; value: IncompatibleRule } | { kind: 'PatternParseError0' /* JSON: "Pattern parse error" */ } | { kind: 'IncompatibleRule0' /* JSON: "Incompatible rule" */ } +| { kind: 'DependencyResolutionError'; value: ResolutionError } export type IncompatibleRule = { rule_id: RuleId; @@ -1468,6 +1469,8 @@ export function writeErrorType(x: ErrorType, context: any = x): any { return 'Pattern parse error' case 'IncompatibleRule0': return 'Incompatible rule' + case 'DependencyResolutionError': + return ['DependencyResolutionError', writeResolutionError(x.value, x)] } } @@ -1532,6 +1535,8 @@ export function readErrorType(x: any, context: any = x): ErrorType { return { kind: 'PartialParsing', value: _atd_read_array(readLocation)(x[1], x) } case 'IncompatibleRule': return { kind: 'IncompatibleRule', value: readIncompatibleRule(x[1], x) } + case 'DependencyResolutionError': + return { kind: 'DependencyResolutionError', value: readResolutionError(x[1], x) } default: _atd_bad_json('ErrorType', x, context) throw new Error('impossible') diff --git a/semgrep_output_v1_j.ml b/semgrep_output_v1_j.ml index e409bb43..085fde77 100644 --- a/semgrep_output_v1_j.ml +++ b/semgrep_output_v1_j.ml @@ -431,6 +431,15 @@ type sarif_format_return = Semgrep_output_v1_t.sarif_format_return = { format_time_seconds: float } +type resolution_cmd_failed = Semgrep_output_v1_t.resolution_cmd_failed = { + command: string; + message: string +} + [@@deriving show] + +type resolution_error = Semgrep_output_v1_t.resolution_error + [@@deriving show] + type incompatible_rule = Semgrep_output_v1_t.incompatible_rule = { rule_id: rule_id; this_version: version; @@ -465,6 +474,7 @@ type error_type = Semgrep_output_v1_t.error_type = | IncompatibleRule of incompatible_rule | PatternParseError0 | IncompatibleRule0 + | DependencyResolutionError of resolution_error [@@deriving show] @@ -535,13 +545,6 @@ type engine_kind = Semgrep_output_v1_t.engine_kind [@@deriving show] type rule_id_and_engine_kind = Semgrep_output_v1_t.rule_id_and_engine_kind -type resolution_cmd_failed = Semgrep_output_v1_t.resolution_cmd_failed = { - command: string; - message: string -} - -type resolution_error = Semgrep_output_v1_t.resolution_error - type resolution_result = Semgrep_output_v1_t.resolution_result type profile = Semgrep_output_v1_t.profile = { @@ -17278,121 +17281,40 @@ let read_sarif_format_return = ( ) let sarif_format_return_of_string s = read_sarif_format_return (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__version_option = ( - Atdgen_runtime.Oj_run.write_std_option ( - write_version - ) -) -let string_of__version_option ?(len = 1024) x = - let ob = Buffer.create len in - write__version_option ob x; - Buffer.contents ob -let read__version_option = ( - fun p lb -> - Yojson.Safe.read_space p lb; - match Yojson.Safe.start_any_variant p lb with - | `Edgy_bracket -> ( - match Yojson.Safe.read_ident p lb with - | "None" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (None : _ option) - | "Some" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read_version - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (Some x : _ option) - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Double_quote -> ( - match Yojson.Safe.finish_string p lb with - | "None" -> - (None : _ option) - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Square_bracket -> ( - match Atdgen_runtime.Oj_run.read_string p lb with - | "Some" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read_version - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - (Some x : _ option) - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) -) -let _version_option_of_string s = - read__version_option (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_incompatible_rule : _ -> incompatible_rule -> _ = ( - fun ob (x : incompatible_rule) -> +let write_resolution_cmd_failed : _ -> resolution_cmd_failed -> _ = ( + fun ob (x : resolution_cmd_failed) -> Buffer.add_char ob '{'; let is_first = ref true in if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"rule_id\":"; + Buffer.add_string ob "\"command\":"; ( - write_rule_id + Yojson.Safe.write_string ) - ob x.rule_id; + ob x.command; if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"this_version\":"; + Buffer.add_string ob "\"message\":"; ( - write_version + Yojson.Safe.write_string ) - ob x.this_version; - (match x.min_version with None -> () | Some x -> - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"min_version\":"; - ( - write_version - ) - ob x; - ); - (match x.max_version with None -> () | Some x -> - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"max_version\":"; - ( - write_version - ) - ob x; - ); + ob x.message; Buffer.add_char ob '}'; ) -let string_of_incompatible_rule ?(len = 1024) x = +let string_of_resolution_cmd_failed ?(len = 1024) x = let ob = Buffer.create len in - write_incompatible_rule ob x; + write_resolution_cmd_failed ob x; Buffer.contents ob -let read_incompatible_rule = ( +let read_resolution_cmd_failed = ( fun p lb -> Yojson.Safe.read_space p lb; Yojson.Safe.read_lcurl p lb; - let field_rule_id = ref (None) in - let field_this_version = ref (None) in - let field_min_version = ref (None) in - let field_max_version = ref (None) in + let field_command = ref (None) in + let field_message = ref (None) in try Yojson.Safe.read_space p lb; Yojson.Safe.read_object_end lb; @@ -17401,94 +17323,52 @@ let read_incompatible_rule = ( fun s pos len -> if pos < 0 || len < 0 || pos + len > String.length s then invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); - match len with - | 7 -> ( - if String.unsafe_get s pos = 'r' && String.unsafe_get s (pos+1) = 'u' && String.unsafe_get s (pos+2) = 'l' && String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = '_' && String.unsafe_get s (pos+5) = 'i' && String.unsafe_get s (pos+6) = 'd' then ( - 0 - ) - else ( - -1 - ) - ) - | 11 -> ( - if String.unsafe_get s pos = 'm' then ( - match String.unsafe_get s (pos+1) with - | 'a' -> ( - if String.unsafe_get s (pos+2) = 'x' && String.unsafe_get s (pos+3) = '_' && String.unsafe_get s (pos+4) = 'v' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = 'r' && String.unsafe_get s (pos+7) = 's' && String.unsafe_get s (pos+8) = 'i' && String.unsafe_get s (pos+9) = 'o' && String.unsafe_get s (pos+10) = 'n' then ( - 3 - ) - else ( - -1 - ) - ) - | 'i' -> ( - if String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = '_' && String.unsafe_get s (pos+4) = 'v' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = 'r' && String.unsafe_get s (pos+7) = 's' && String.unsafe_get s (pos+8) = 'i' && String.unsafe_get s (pos+9) = 'o' && String.unsafe_get s (pos+10) = 'n' then ( - 2 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - ) - else ( - -1 + if len = 7 then ( + match String.unsafe_get s pos with + | 'c' -> ( + if String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'm' && String.unsafe_get s (pos+3) = 'm' && String.unsafe_get s (pos+4) = 'a' && String.unsafe_get s (pos+5) = 'n' && String.unsafe_get s (pos+6) = 'd' then ( + 0 + ) + else ( + -1 + ) ) - ) - | 12 -> ( - if String.unsafe_get s pos = 't' && String.unsafe_get s (pos+1) = 'h' && String.unsafe_get s (pos+2) = 'i' && String.unsafe_get s (pos+3) = 's' && String.unsafe_get s (pos+4) = '_' && String.unsafe_get s (pos+5) = 'v' && String.unsafe_get s (pos+6) = 'e' && String.unsafe_get s (pos+7) = 'r' && String.unsafe_get s (pos+8) = 's' && String.unsafe_get s (pos+9) = 'i' && String.unsafe_get s (pos+10) = 'o' && String.unsafe_get s (pos+11) = 'n' then ( - 1 + | 'm' -> ( + if String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 's' && String.unsafe_get s (pos+3) = 's' && String.unsafe_get s (pos+4) = 'a' && String.unsafe_get s (pos+5) = 'g' && String.unsafe_get s (pos+6) = 'e' then ( + 1 + ) + else ( + -1 + ) ) - else ( + | _ -> ( -1 ) - ) - | _ -> ( - -1 - ) + ) + else ( + -1 + ) in let i = Yojson.Safe.map_ident p f lb in Atdgen_runtime.Oj_run.read_until_field_value p lb; ( match i with | 0 -> - field_rule_id := ( + field_command := ( Some ( ( - read_rule_id + Atdgen_runtime.Oj_run.read_string ) p lb ) ); | 1 -> - field_this_version := ( + field_message := ( Some ( ( - read_version + Atdgen_runtime.Oj_run.read_string ) p lb ) ); - | 2 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_min_version := ( - Some ( - ( - read_version - ) p lb - ) - ); - ) - | 3 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_max_version := ( - Some ( - ( - read_version - ) p lb - ) - ); - ) | _ -> ( Yojson.Safe.skip_json p lb ) @@ -17501,94 +17381,52 @@ let read_incompatible_rule = ( fun s pos len -> if pos < 0 || len < 0 || pos + len > String.length s then invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); - match len with - | 7 -> ( - if String.unsafe_get s pos = 'r' && String.unsafe_get s (pos+1) = 'u' && String.unsafe_get s (pos+2) = 'l' && String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = '_' && String.unsafe_get s (pos+5) = 'i' && String.unsafe_get s (pos+6) = 'd' then ( - 0 + if len = 7 then ( + match String.unsafe_get s pos with + | 'c' -> ( + if String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'm' && String.unsafe_get s (pos+3) = 'm' && String.unsafe_get s (pos+4) = 'a' && String.unsafe_get s (pos+5) = 'n' && String.unsafe_get s (pos+6) = 'd' then ( + 0 + ) + else ( + -1 + ) ) - else ( + | 'm' -> ( + if String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 's' && String.unsafe_get s (pos+3) = 's' && String.unsafe_get s (pos+4) = 'a' && String.unsafe_get s (pos+5) = 'g' && String.unsafe_get s (pos+6) = 'e' then ( + 1 + ) + else ( + -1 + ) + ) + | _ -> ( -1 ) - ) - | 11 -> ( - if String.unsafe_get s pos = 'm' then ( - match String.unsafe_get s (pos+1) with - | 'a' -> ( - if String.unsafe_get s (pos+2) = 'x' && String.unsafe_get s (pos+3) = '_' && String.unsafe_get s (pos+4) = 'v' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = 'r' && String.unsafe_get s (pos+7) = 's' && String.unsafe_get s (pos+8) = 'i' && String.unsafe_get s (pos+9) = 'o' && String.unsafe_get s (pos+10) = 'n' then ( - 3 - ) - else ( - -1 - ) - ) - | 'i' -> ( - if String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = '_' && String.unsafe_get s (pos+4) = 'v' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = 'r' && String.unsafe_get s (pos+7) = 's' && String.unsafe_get s (pos+8) = 'i' && String.unsafe_get s (pos+9) = 'o' && String.unsafe_get s (pos+10) = 'n' then ( - 2 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - ) - else ( - -1 - ) - ) - | 12 -> ( - if String.unsafe_get s pos = 't' && String.unsafe_get s (pos+1) = 'h' && String.unsafe_get s (pos+2) = 'i' && String.unsafe_get s (pos+3) = 's' && String.unsafe_get s (pos+4) = '_' && String.unsafe_get s (pos+5) = 'v' && String.unsafe_get s (pos+6) = 'e' && String.unsafe_get s (pos+7) = 'r' && String.unsafe_get s (pos+8) = 's' && String.unsafe_get s (pos+9) = 'i' && String.unsafe_get s (pos+10) = 'o' && String.unsafe_get s (pos+11) = 'n' then ( - 1 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - in - let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; - ( - match i with - | 0 -> - field_rule_id := ( - Some ( - ( - read_rule_id - ) p lb + ) + else ( + -1 + ) + in + let i = Yojson.Safe.map_ident p f lb in + Atdgen_runtime.Oj_run.read_until_field_value p lb; + ( + match i with + | 0 -> + field_command := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_string + ) p lb ) ); | 1 -> - field_this_version := ( + field_message := ( Some ( ( - read_version + Atdgen_runtime.Oj_run.read_string ) p lb ) ); - | 2 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_min_version := ( - Some ( - ( - read_version - ) p lb - ) - ); - ) - | 3 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_max_version := ( - Some ( - ( - read_version - ) p lb - ) - ); - ) | _ -> ( Yojson.Safe.skip_json p lb ) @@ -17598,399 +17436,139 @@ let read_incompatible_rule = ( with Yojson.End_of_object -> ( ( { - rule_id = (match !field_rule_id with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "rule_id"); - this_version = (match !field_this_version with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "this_version"); - min_version = !field_min_version; - max_version = !field_max_version; + command = (match !field_command with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "command"); + message = (match !field_message with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "message"); } - : incompatible_rule) + : resolution_cmd_failed) ) ) -let incompatible_rule_of_string s = - read_incompatible_rule (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__location_list = ( - Atdgen_runtime.Oj_run.write_list ( - write_location - ) -) -let string_of__location_list ?(len = 1024) x = - let ob = Buffer.create len in - write__location_list ob x; - Buffer.contents ob -let read__location_list = ( - Atdgen_runtime.Oj_run.read_list ( - read_location - ) -) -let _location_list_of_string s = - read__location_list (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_error_type : _ -> error_type -> _ = ( - fun ob (x : error_type) -> +let resolution_cmd_failed_of_string s = + read_resolution_cmd_failed (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_resolution_error = ( + fun ob x -> match x with - | LexicalError -> Buffer.add_string ob "\"Lexical error\"" - | ParseError -> Buffer.add_string ob "\"Syntax error\"" - | OtherParseError -> Buffer.add_string ob "\"Other syntax error\"" - | AstBuilderError -> Buffer.add_string ob "\"AST builder error\"" - | RuleParseError -> Buffer.add_string ob "\"Rule parse error\"" - | SemgrepWarning -> Buffer.add_string ob "\"SemgrepWarning\"" - | SemgrepError -> Buffer.add_string ob "\"SemgrepError\"" - | InvalidRuleSchemaError -> Buffer.add_string ob "\"InvalidRuleSchemaError\"" - | UnknownLanguageError -> Buffer.add_string ob "\"UnknownLanguageError\"" - | InvalidYaml -> Buffer.add_string ob "\"Invalid YAML\"" - | MatchingError -> Buffer.add_string ob "\"Internal matching error\"" - | SemgrepMatchFound -> Buffer.add_string ob "\"Semgrep match found\"" - | TooManyMatches -> Buffer.add_string ob "\"Too many matches\"" - | FatalError -> Buffer.add_string ob "\"Fatal error\"" - | Timeout -> Buffer.add_string ob "\"Timeout\"" - | OutOfMemory -> Buffer.add_string ob "\"Out of memory\"" - | StackOverflow -> Buffer.add_string ob "\"Stack overflow\"" - | TimeoutDuringInterfile -> Buffer.add_string ob "\"Timeout during interfile analysis\"" - | OutOfMemoryDuringInterfile -> Buffer.add_string ob "\"OOM during interfile analysis\"" - | MissingPlugin -> Buffer.add_string ob "\"Missing plugin\"" - | PatternParseError x -> - Buffer.add_string ob "[\"PatternParseError\","; + | `UnsupportedManifest -> Buffer.add_string ob "\"UnsupportedManifest\"" + | `MissingRequirement x -> + Buffer.add_string ob "[\"MissingRequirement\","; ( - write__string_list + Yojson.Safe.write_string ) ob x; Buffer.add_char ob ']' - | PartialParsing x -> - Buffer.add_string ob "[\"PartialParsing\","; + | `ResolutionCmdFailed x -> + Buffer.add_string ob "[\"ResolutionCmdFailed\","; ( - write__location_list + write_resolution_cmd_failed ) ob x; Buffer.add_char ob ']' - | IncompatibleRule x -> - Buffer.add_string ob "[\"IncompatibleRule\","; + | `ParseDependenciesFailed x -> + Buffer.add_string ob "[\"ParseDependenciesFailed\","; ( - write_incompatible_rule + Yojson.Safe.write_string ) ob x; Buffer.add_char ob ']' - | PatternParseError0 -> Buffer.add_string ob "\"Pattern parse error\"" - | IncompatibleRule0 -> Buffer.add_string ob "\"Incompatible rule\"" ) -let string_of_error_type ?(len = 1024) x = +let string_of_resolution_error ?(len = 1024) x = let ob = Buffer.create len in - write_error_type ob x; + write_resolution_error ob x; Buffer.contents ob -let read_error_type = ( +let read_resolution_error = ( fun p lb -> Yojson.Safe.read_space p lb; match Yojson.Safe.start_any_variant p lb with | `Edgy_bracket -> ( match Yojson.Safe.read_ident p lb with - | "Lexical error" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (LexicalError : error_type) - | "Syntax error" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (ParseError : error_type) - | "Other syntax error" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (OtherParseError : error_type) - | "AST builder error" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (AstBuilderError : error_type) - | "Rule parse error" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (RuleParseError : error_type) - | "SemgrepWarning" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (SemgrepWarning : error_type) - | "SemgrepError" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (SemgrepError : error_type) - | "InvalidRuleSchemaError" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (InvalidRuleSchemaError : error_type) - | "UnknownLanguageError" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (UnknownLanguageError : error_type) - | "Invalid YAML" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (InvalidYaml : error_type) - | "Internal matching error" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (MatchingError : error_type) - | "Semgrep match found" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (SemgrepMatchFound : error_type) - | "Too many matches" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (TooManyMatches : error_type) - | "Fatal error" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (FatalError : error_type) - | "Timeout" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (Timeout : error_type) - | "Out of memory" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (OutOfMemory : error_type) - | "Stack overflow" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (StackOverflow : error_type) - | "Timeout during interfile analysis" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (TimeoutDuringInterfile : error_type) - | "OOM during interfile analysis" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (OutOfMemoryDuringInterfile : error_type) - | "Missing plugin" -> + | "UnsupportedManifest" -> Yojson.Safe.read_space p lb; Yojson.Safe.read_gt p lb; - (MissingPlugin : error_type) - | "PatternParseError" -> + `UnsupportedManifest + | "MissingRequirement" -> Atdgen_runtime.Oj_run.read_until_field_value p lb; let x = ( - read__string_list + Atdgen_runtime.Oj_run.read_string ) p lb in Yojson.Safe.read_space p lb; Yojson.Safe.read_gt p lb; - (PatternParseError x : error_type) - | "PartialParsing" -> + `MissingRequirement x + | "ResolutionCmdFailed" -> Atdgen_runtime.Oj_run.read_until_field_value p lb; let x = ( - read__location_list + read_resolution_cmd_failed ) p lb in Yojson.Safe.read_space p lb; Yojson.Safe.read_gt p lb; - (PartialParsing x : error_type) - | "IncompatibleRule" -> + `ResolutionCmdFailed x + | "ParseDependenciesFailed" -> Atdgen_runtime.Oj_run.read_until_field_value p lb; let x = ( - read_incompatible_rule + Atdgen_runtime.Oj_run.read_string ) p lb in Yojson.Safe.read_space p lb; Yojson.Safe.read_gt p lb; - (IncompatibleRule x : error_type) - | "Pattern parse error" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (PatternParseError0 : error_type) - | "Incompatible rule" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (IncompatibleRule0 : error_type) + `ParseDependenciesFailed x | x -> Atdgen_runtime.Oj_run.invalid_variant_tag p x ) | `Double_quote -> ( match Yojson.Safe.finish_string p lb with - | "Lexical error" -> - (LexicalError : error_type) - | "Syntax error" -> - (ParseError : error_type) - | "Other syntax error" -> - (OtherParseError : error_type) - | "AST builder error" -> - (AstBuilderError : error_type) - | "Rule parse error" -> - (RuleParseError : error_type) - | "SemgrepWarning" -> - (SemgrepWarning : error_type) - | "SemgrepError" -> - (SemgrepError : error_type) - | "InvalidRuleSchemaError" -> - (InvalidRuleSchemaError : error_type) - | "UnknownLanguageError" -> - (UnknownLanguageError : error_type) - | "Invalid YAML" -> - (InvalidYaml : error_type) - | "Internal matching error" -> - (MatchingError : error_type) - | "Semgrep match found" -> - (SemgrepMatchFound : error_type) - | "Too many matches" -> - (TooManyMatches : error_type) - | "Fatal error" -> - (FatalError : error_type) - | "Timeout" -> - (Timeout : error_type) - | "Out of memory" -> - (OutOfMemory : error_type) - | "Stack overflow" -> - (StackOverflow : error_type) - | "Timeout during interfile analysis" -> - (TimeoutDuringInterfile : error_type) - | "OOM during interfile analysis" -> - (OutOfMemoryDuringInterfile : error_type) - | "Missing plugin" -> - (MissingPlugin : error_type) - | "Pattern parse error" -> - (PatternParseError0 : error_type) - | "Incompatible rule" -> - (IncompatibleRule0 : error_type) + | "UnsupportedManifest" -> + `UnsupportedManifest | x -> Atdgen_runtime.Oj_run.invalid_variant_tag p x ) | `Square_bracket -> ( match Atdgen_runtime.Oj_run.read_string p lb with - | "PatternParseError" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read__string_list - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - (PatternParseError x : error_type) - | "PartialParsing" -> + | "MissingRequirement" -> Yojson.Safe.read_space p lb; Yojson.Safe.read_comma p lb; Yojson.Safe.read_space p lb; let x = ( - read__location_list + Atdgen_runtime.Oj_run.read_string ) p lb in Yojson.Safe.read_space p lb; Yojson.Safe.read_rbr p lb; - (PartialParsing x : error_type) - | "IncompatibleRule" -> + `MissingRequirement x + | "ResolutionCmdFailed" -> Yojson.Safe.read_space p lb; Yojson.Safe.read_comma p lb; Yojson.Safe.read_space p lb; let x = ( - read_incompatible_rule + read_resolution_cmd_failed ) p lb in Yojson.Safe.read_space p lb; Yojson.Safe.read_rbr p lb; - (IncompatibleRule x : error_type) - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) -) -let error_type_of_string s = - read_error_type (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__string_list_nullable = ( - Atdgen_runtime.Oj_run.write_nullable ( - write__string_list - ) -) -let string_of__string_list_nullable ?(len = 1024) x = - let ob = Buffer.create len in - write__string_list_nullable ob x; - Buffer.contents ob -let read__string_list_nullable = ( - fun p lb -> - Yojson.Safe.read_space p lb; - (if Yojson.Safe.read_null_if_possible p lb then None - else Some (( - read__string_list - ) p lb) : _ option) -) -let _string_list_nullable_of_string s = - read__string_list_nullable (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__string_list_nullable_option = ( - Atdgen_runtime.Oj_run.write_std_option ( - write__string_list_nullable - ) -) -let string_of__string_list_nullable_option ?(len = 1024) x = - let ob = Buffer.create len in - write__string_list_nullable_option ob x; - Buffer.contents ob -let read__string_list_nullable_option = ( - fun p lb -> - Yojson.Safe.read_space p lb; - match Yojson.Safe.start_any_variant p lb with - | `Edgy_bracket -> ( - match Yojson.Safe.read_ident p lb with - | "None" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (None : _ option) - | "Some" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read__string_list_nullable - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (Some x : _ option) - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Double_quote -> ( - match Yojson.Safe.finish_string p lb with - | "None" -> - (None : _ option) - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Square_bracket -> ( - match Atdgen_runtime.Oj_run.read_string p lb with - | "Some" -> + `ResolutionCmdFailed x + | "ParseDependenciesFailed" -> Yojson.Safe.read_space p lb; Yojson.Safe.read_comma p lb; Yojson.Safe.read_space p lb; let x = ( - read__string_list_nullable + Atdgen_runtime.Oj_run.read_string ) p lb in Yojson.Safe.read_space p lb; Yojson.Safe.read_rbr p lb; - (Some x : _ option) + `ParseDependenciesFailed x | x -> Atdgen_runtime.Oj_run.invalid_variant_tag p x ) ) -let _string_list_nullable_option_of_string s = - read__string_list_nullable_option (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__position_nullable = ( - Atdgen_runtime.Oj_run.write_nullable ( - write_position - ) -) -let string_of__position_nullable ?(len = 1024) x = - let ob = Buffer.create len in - write__position_nullable ob x; - Buffer.contents ob -let read__position_nullable = ( - fun p lb -> - Yojson.Safe.read_space p lb; - (if Yojson.Safe.read_null_if_possible p lb then None - else Some (( - read_position - ) p lb) : _ option) -) -let _position_nullable_of_string s = - read__position_nullable (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__position_nullable_option = ( +let resolution_error_of_string s = + read_resolution_error (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write__version_option = ( Atdgen_runtime.Oj_run.write_std_option ( - write__position_nullable + write_version ) ) -let string_of__position_nullable_option ?(len = 1024) x = +let string_of__version_option ?(len = 1024) x = let ob = Buffer.create len in - write__position_nullable_option ob x; + write__version_option ob x; Buffer.contents ob -let read__position_nullable_option = ( +let read__version_option = ( fun p lb -> Yojson.Safe.read_space p lb; match Yojson.Safe.start_any_variant p lb with @@ -18003,7 +17581,7 @@ let read__position_nullable_option = ( | "Some" -> Atdgen_runtime.Oj_run.read_until_field_value p lb; let x = ( - read__position_nullable + read_version ) p lb in Yojson.Safe.read_space p lb; @@ -18026,7 +17604,7 @@ let read__position_nullable_option = ( Yojson.Safe.read_comma p lb; Yojson.Safe.read_space p lb; let x = ( - read__position_nullable + read_version ) p lb in Yojson.Safe.read_space p lb; @@ -18036,124 +17614,66 @@ let read__position_nullable_option = ( Atdgen_runtime.Oj_run.invalid_variant_tag p x ) ) -let _position_nullable_option_of_string s = - read__position_nullable_option (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_error_span : _ -> error_span -> _ = ( - fun ob (x : error_span) -> +let _version_option_of_string s = + read__version_option (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_incompatible_rule : _ -> incompatible_rule -> _ = ( + fun ob (x : incompatible_rule) -> Buffer.add_char ob '{'; let is_first = ref true in if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"file\":"; - ( - write_fpath - ) - ob x.file; - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"start\":"; + Buffer.add_string ob "\"rule_id\":"; ( - write_position + write_rule_id ) - ob x.start; + ob x.rule_id; if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"end\":"; + Buffer.add_string ob "\"this_version\":"; ( - write_position + write_version ) - ob x.end_; - (match x.source_hash with None -> () | Some x -> - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"source_hash\":"; - ( - Yojson.Safe.write_string - ) - ob x; - ); - (match x.config_start with None -> () | Some x -> - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"config_start\":"; - ( - write__position_nullable - ) - ob x; - ); - (match x.config_end with None -> () | Some x -> - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"config_end\":"; - ( - write__position_nullable - ) - ob x; - ); - (match x.config_path with None -> () | Some x -> + ob x.this_version; + (match x.min_version with None -> () | Some x -> if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"config_path\":"; + Buffer.add_string ob "\"min_version\":"; ( - write__string_list_nullable + write_version ) ob x; ); - (match x.context_start with None -> () | Some x -> + (match x.max_version with None -> () | Some x -> if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"context_start\":"; + Buffer.add_string ob "\"max_version\":"; ( - write__position_nullable - ) - ob x; - ); - (match x.context_end with None -> () | Some x -> - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"context_end\":"; - ( - write__position_nullable + write_version ) ob x; ); Buffer.add_char ob '}'; ) -let string_of_error_span ?(len = 1024) x = +let string_of_incompatible_rule ?(len = 1024) x = let ob = Buffer.create len in - write_error_span ob x; + write_incompatible_rule ob x; Buffer.contents ob -let read_error_span = ( +let read_incompatible_rule = ( fun p lb -> Yojson.Safe.read_space p lb; Yojson.Safe.read_lcurl p lb; - let field_file = ref (None) in - let field_start = ref (None) in - let field_end_ = ref (None) in - let field_source_hash = ref (None) in - let field_config_start = ref (None) in - let field_config_end = ref (None) in - let field_config_path = ref (None) in - let field_context_start = ref (None) in - let field_context_end = ref (None) in + let field_rule_id = ref (None) in + let field_this_version = ref (None) in + let field_min_version = ref (None) in + let field_max_version = ref (None) in try Yojson.Safe.read_space p lb; Yojson.Safe.read_object_end lb; @@ -18163,90 +17683,44 @@ let read_error_span = ( if pos < 0 || len < 0 || pos + len > String.length s then invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); match len with - | 3 -> ( - if String.unsafe_get s pos = 'e' && String.unsafe_get s (pos+1) = 'n' && String.unsafe_get s (pos+2) = 'd' then ( - 2 - ) - else ( - -1 - ) - ) - | 4 -> ( - if String.unsafe_get s pos = 'f' && String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = 'l' && String.unsafe_get s (pos+3) = 'e' then ( + | 7 -> ( + if String.unsafe_get s pos = 'r' && String.unsafe_get s (pos+1) = 'u' && String.unsafe_get s (pos+2) = 'l' && String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = '_' && String.unsafe_get s (pos+5) = 'i' && String.unsafe_get s (pos+6) = 'd' then ( 0 ) else ( -1 ) ) - | 5 -> ( - if String.unsafe_get s pos = 's' && String.unsafe_get s (pos+1) = 't' && String.unsafe_get s (pos+2) = 'a' && String.unsafe_get s (pos+3) = 'r' && String.unsafe_get s (pos+4) = 't' then ( - 1 - ) - else ( - -1 - ) - ) - | 10 -> ( - if String.unsafe_get s pos = 'c' && String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = 'f' && String.unsafe_get s (pos+4) = 'i' && String.unsafe_get s (pos+5) = 'g' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 'e' && String.unsafe_get s (pos+8) = 'n' && String.unsafe_get s (pos+9) = 'd' then ( - 5 - ) - else ( - -1 - ) - ) | 11 -> ( - match String.unsafe_get s pos with - | 'c' -> ( - if String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'n' then ( - match String.unsafe_get s (pos+3) with - | 'f' -> ( - if String.unsafe_get s (pos+4) = 'i' && String.unsafe_get s (pos+5) = 'g' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 'p' && String.unsafe_get s (pos+8) = 'a' && String.unsafe_get s (pos+9) = 't' && String.unsafe_get s (pos+10) = 'h' then ( - 6 - ) - else ( - -1 - ) - ) - | 't' -> ( - if String.unsafe_get s (pos+4) = 'e' && String.unsafe_get s (pos+5) = 'x' && String.unsafe_get s (pos+6) = 't' && String.unsafe_get s (pos+7) = '_' && String.unsafe_get s (pos+8) = 'e' && String.unsafe_get s (pos+9) = 'n' && String.unsafe_get s (pos+10) = 'd' then ( - 8 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - ) - else ( - -1 + if String.unsafe_get s pos = 'm' then ( + match String.unsafe_get s (pos+1) with + | 'a' -> ( + if String.unsafe_get s (pos+2) = 'x' && String.unsafe_get s (pos+3) = '_' && String.unsafe_get s (pos+4) = 'v' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = 'r' && String.unsafe_get s (pos+7) = 's' && String.unsafe_get s (pos+8) = 'i' && String.unsafe_get s (pos+9) = 'o' && String.unsafe_get s (pos+10) = 'n' then ( + 3 + ) + else ( + -1 + ) ) - ) - | 's' -> ( - if String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'u' && String.unsafe_get s (pos+3) = 'r' && String.unsafe_get s (pos+4) = 'c' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 'h' && String.unsafe_get s (pos+8) = 'a' && String.unsafe_get s (pos+9) = 's' && String.unsafe_get s (pos+10) = 'h' then ( - 3 + | 'i' -> ( + if String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = '_' && String.unsafe_get s (pos+4) = 'v' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = 'r' && String.unsafe_get s (pos+7) = 's' && String.unsafe_get s (pos+8) = 'i' && String.unsafe_get s (pos+9) = 'o' && String.unsafe_get s (pos+10) = 'n' then ( + 2 + ) + else ( + -1 + ) ) - else ( + | _ -> ( -1 ) - ) - | _ -> ( - -1 - ) - ) - | 12 -> ( - if String.unsafe_get s pos = 'c' && String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = 'f' && String.unsafe_get s (pos+4) = 'i' && String.unsafe_get s (pos+5) = 'g' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 's' && String.unsafe_get s (pos+8) = 't' && String.unsafe_get s (pos+9) = 'a' && String.unsafe_get s (pos+10) = 'r' && String.unsafe_get s (pos+11) = 't' then ( - 4 ) else ( -1 ) ) - | 13 -> ( - if String.unsafe_get s pos = 'c' && String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = 't' && String.unsafe_get s (pos+4) = 'e' && String.unsafe_get s (pos+5) = 'x' && String.unsafe_get s (pos+6) = 't' && String.unsafe_get s (pos+7) = '_' && String.unsafe_get s (pos+8) = 's' && String.unsafe_get s (pos+9) = 't' && String.unsafe_get s (pos+10) = 'a' && String.unsafe_get s (pos+11) = 'r' && String.unsafe_get s (pos+12) = 't' then ( - 7 + | 12 -> ( + if String.unsafe_get s pos = 't' && String.unsafe_get s (pos+1) = 'h' && String.unsafe_get s (pos+2) = 'i' && String.unsafe_get s (pos+3) = 's' && String.unsafe_get s (pos+4) = '_' && String.unsafe_get s (pos+5) = 'v' && String.unsafe_get s (pos+6) = 'e' && String.unsafe_get s (pos+7) = 'r' && String.unsafe_get s (pos+8) = 's' && String.unsafe_get s (pos+9) = 'i' && String.unsafe_get s (pos+10) = 'o' && String.unsafe_get s (pos+11) = 'n' then ( + 1 ) else ( -1 @@ -18261,85 +17735,37 @@ let read_error_span = ( ( match i with | 0 -> - field_file := ( + field_rule_id := ( Some ( ( - read_fpath + read_rule_id ) p lb ) ); | 1 -> - field_start := ( + field_this_version := ( Some ( ( - read_position + read_version ) p lb ) ); | 2 -> - field_end_ := ( - Some ( - ( - read_position - ) p lb - ) - ); - | 3 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_source_hash := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_string - ) p lb - ) - ); - ) - | 4 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_config_start := ( - Some ( - ( - read__position_nullable - ) p lb - ) - ); - ) - | 5 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_config_end := ( - Some ( - ( - read__position_nullable - ) p lb - ) - ); - ) - | 6 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_config_path := ( - Some ( - ( - read__string_list_nullable - ) p lb - ) - ); - ) - | 7 -> if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_context_start := ( + field_min_version := ( Some ( ( - read__position_nullable + read_version ) p lb ) ); ) - | 8 -> + | 3 -> if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_context_end := ( + field_max_version := ( Some ( ( - read__position_nullable + read_version ) p lb ) ); @@ -18357,97 +17783,51 @@ let read_error_span = ( if pos < 0 || len < 0 || pos + len > String.length s then invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); match len with - | 3 -> ( - if String.unsafe_get s pos = 'e' && String.unsafe_get s (pos+1) = 'n' && String.unsafe_get s (pos+2) = 'd' then ( - 2 + | 7 -> ( + if String.unsafe_get s pos = 'r' && String.unsafe_get s (pos+1) = 'u' && String.unsafe_get s (pos+2) = 'l' && String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = '_' && String.unsafe_get s (pos+5) = 'i' && String.unsafe_get s (pos+6) = 'd' then ( + 0 ) else ( -1 ) ) - | 4 -> ( - if String.unsafe_get s pos = 'f' && String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = 'l' && String.unsafe_get s (pos+3) = 'e' then ( - 0 + | 11 -> ( + if String.unsafe_get s pos = 'm' then ( + match String.unsafe_get s (pos+1) with + | 'a' -> ( + if String.unsafe_get s (pos+2) = 'x' && String.unsafe_get s (pos+3) = '_' && String.unsafe_get s (pos+4) = 'v' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = 'r' && String.unsafe_get s (pos+7) = 's' && String.unsafe_get s (pos+8) = 'i' && String.unsafe_get s (pos+9) = 'o' && String.unsafe_get s (pos+10) = 'n' then ( + 3 + ) + else ( + -1 + ) + ) + | 'i' -> ( + if String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = '_' && String.unsafe_get s (pos+4) = 'v' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = 'r' && String.unsafe_get s (pos+7) = 's' && String.unsafe_get s (pos+8) = 'i' && String.unsafe_get s (pos+9) = 'o' && String.unsafe_get s (pos+10) = 'n' then ( + 2 + ) + else ( + -1 + ) + ) + | _ -> ( + -1 + ) ) else ( -1 ) ) - | 5 -> ( - if String.unsafe_get s pos = 's' && String.unsafe_get s (pos+1) = 't' && String.unsafe_get s (pos+2) = 'a' && String.unsafe_get s (pos+3) = 'r' && String.unsafe_get s (pos+4) = 't' then ( + | 12 -> ( + if String.unsafe_get s pos = 't' && String.unsafe_get s (pos+1) = 'h' && String.unsafe_get s (pos+2) = 'i' && String.unsafe_get s (pos+3) = 's' && String.unsafe_get s (pos+4) = '_' && String.unsafe_get s (pos+5) = 'v' && String.unsafe_get s (pos+6) = 'e' && String.unsafe_get s (pos+7) = 'r' && String.unsafe_get s (pos+8) = 's' && String.unsafe_get s (pos+9) = 'i' && String.unsafe_get s (pos+10) = 'o' && String.unsafe_get s (pos+11) = 'n' then ( 1 ) else ( -1 ) ) - | 10 -> ( - if String.unsafe_get s pos = 'c' && String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = 'f' && String.unsafe_get s (pos+4) = 'i' && String.unsafe_get s (pos+5) = 'g' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 'e' && String.unsafe_get s (pos+8) = 'n' && String.unsafe_get s (pos+9) = 'd' then ( - 5 - ) - else ( - -1 - ) - ) - | 11 -> ( - match String.unsafe_get s pos with - | 'c' -> ( - if String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'n' then ( - match String.unsafe_get s (pos+3) with - | 'f' -> ( - if String.unsafe_get s (pos+4) = 'i' && String.unsafe_get s (pos+5) = 'g' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 'p' && String.unsafe_get s (pos+8) = 'a' && String.unsafe_get s (pos+9) = 't' && String.unsafe_get s (pos+10) = 'h' then ( - 6 - ) - else ( - -1 - ) - ) - | 't' -> ( - if String.unsafe_get s (pos+4) = 'e' && String.unsafe_get s (pos+5) = 'x' && String.unsafe_get s (pos+6) = 't' && String.unsafe_get s (pos+7) = '_' && String.unsafe_get s (pos+8) = 'e' && String.unsafe_get s (pos+9) = 'n' && String.unsafe_get s (pos+10) = 'd' then ( - 8 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - ) - else ( - -1 - ) - ) - | 's' -> ( - if String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'u' && String.unsafe_get s (pos+3) = 'r' && String.unsafe_get s (pos+4) = 'c' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 'h' && String.unsafe_get s (pos+8) = 'a' && String.unsafe_get s (pos+9) = 's' && String.unsafe_get s (pos+10) = 'h' then ( - 3 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - ) - | 12 -> ( - if String.unsafe_get s pos = 'c' && String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = 'f' && String.unsafe_get s (pos+4) = 'i' && String.unsafe_get s (pos+5) = 'g' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 's' && String.unsafe_get s (pos+8) = 't' && String.unsafe_get s (pos+9) = 'a' && String.unsafe_get s (pos+10) = 'r' && String.unsafe_get s (pos+11) = 't' then ( - 4 - ) - else ( - -1 - ) - ) - | 13 -> ( - if String.unsafe_get s pos = 'c' && String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = 't' && String.unsafe_get s (pos+4) = 'e' && String.unsafe_get s (pos+5) = 'x' && String.unsafe_get s (pos+6) = 't' && String.unsafe_get s (pos+7) = '_' && String.unsafe_get s (pos+8) = 's' && String.unsafe_get s (pos+9) = 't' && String.unsafe_get s (pos+10) = 'a' && String.unsafe_get s (pos+11) = 'r' && String.unsafe_get s (pos+12) = 't' then ( - 7 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 + | _ -> ( + -1 ) in let i = Yojson.Safe.map_ident p f lb in @@ -18455,85 +17835,37 @@ let read_error_span = ( ( match i with | 0 -> - field_file := ( + field_rule_id := ( Some ( ( - read_fpath + read_rule_id ) p lb ) ); | 1 -> - field_start := ( + field_this_version := ( Some ( ( - read_position + read_version ) p lb ) ); | 2 -> - field_end_ := ( - Some ( - ( - read_position - ) p lb - ) - ); - | 3 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_source_hash := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_string - ) p lb - ) - ); - ) - | 4 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_config_start := ( - Some ( - ( - read__position_nullable - ) p lb - ) - ); - ) - | 5 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_config_end := ( - Some ( - ( - read__position_nullable - ) p lb - ) - ); - ) - | 6 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_config_path := ( - Some ( - ( - read__string_list_nullable - ) p lb - ) - ); - ) - | 7 -> if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_context_start := ( + field_min_version := ( Some ( ( - read__position_nullable + read_version ) p lb ) ); ) - | 8 -> + | 3 -> if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_context_end := ( + field_max_version := ( Some ( ( - read__position_nullable + read_version ) p lb ) ); @@ -18547,196 +17879,349 @@ let read_error_span = ( with Yojson.End_of_object -> ( ( { - file = (match !field_file with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "file"); - start = (match !field_start with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "start"); - end_ = (match !field_end_ with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "end_"); - source_hash = !field_source_hash; - config_start = !field_config_start; - config_end = !field_config_end; - config_path = !field_config_path; - context_start = !field_context_start; - context_end = !field_context_end; + rule_id = (match !field_rule_id with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "rule_id"); + this_version = (match !field_this_version with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "this_version"); + min_version = !field_min_version; + max_version = !field_max_version; } - : error_span) + : incompatible_rule) ) ) -let error_span_of_string s = - read_error_span (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_error_severity = ( - fun ob x -> +let incompatible_rule_of_string s = + read_incompatible_rule (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write__location_list = ( + Atdgen_runtime.Oj_run.write_list ( + write_location + ) +) +let string_of__location_list ?(len = 1024) x = + let ob = Buffer.create len in + write__location_list ob x; + Buffer.contents ob +let read__location_list = ( + Atdgen_runtime.Oj_run.read_list ( + read_location + ) +) +let _location_list_of_string s = + read__location_list (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_error_type : _ -> error_type -> _ = ( + fun ob (x : error_type) -> match x with - | `Error -> Buffer.add_string ob "\"error\"" - | `Warning -> Buffer.add_string ob "\"warn\"" - | `Info -> Buffer.add_string ob "\"info\"" + | LexicalError -> Buffer.add_string ob "\"Lexical error\"" + | ParseError -> Buffer.add_string ob "\"Syntax error\"" + | OtherParseError -> Buffer.add_string ob "\"Other syntax error\"" + | AstBuilderError -> Buffer.add_string ob "\"AST builder error\"" + | RuleParseError -> Buffer.add_string ob "\"Rule parse error\"" + | SemgrepWarning -> Buffer.add_string ob "\"SemgrepWarning\"" + | SemgrepError -> Buffer.add_string ob "\"SemgrepError\"" + | InvalidRuleSchemaError -> Buffer.add_string ob "\"InvalidRuleSchemaError\"" + | UnknownLanguageError -> Buffer.add_string ob "\"UnknownLanguageError\"" + | InvalidYaml -> Buffer.add_string ob "\"Invalid YAML\"" + | MatchingError -> Buffer.add_string ob "\"Internal matching error\"" + | SemgrepMatchFound -> Buffer.add_string ob "\"Semgrep match found\"" + | TooManyMatches -> Buffer.add_string ob "\"Too many matches\"" + | FatalError -> Buffer.add_string ob "\"Fatal error\"" + | Timeout -> Buffer.add_string ob "\"Timeout\"" + | OutOfMemory -> Buffer.add_string ob "\"Out of memory\"" + | StackOverflow -> Buffer.add_string ob "\"Stack overflow\"" + | TimeoutDuringInterfile -> Buffer.add_string ob "\"Timeout during interfile analysis\"" + | OutOfMemoryDuringInterfile -> Buffer.add_string ob "\"OOM during interfile analysis\"" + | MissingPlugin -> Buffer.add_string ob "\"Missing plugin\"" + | PatternParseError x -> + Buffer.add_string ob "[\"PatternParseError\","; + ( + write__string_list + ) ob x; + Buffer.add_char ob ']' + | PartialParsing x -> + Buffer.add_string ob "[\"PartialParsing\","; + ( + write__location_list + ) ob x; + Buffer.add_char ob ']' + | IncompatibleRule x -> + Buffer.add_string ob "[\"IncompatibleRule\","; + ( + write_incompatible_rule + ) ob x; + Buffer.add_char ob ']' + | PatternParseError0 -> Buffer.add_string ob "\"Pattern parse error\"" + | IncompatibleRule0 -> Buffer.add_string ob "\"Incompatible rule\"" + | DependencyResolutionError x -> + Buffer.add_string ob "[\"DependencyResolutionError\","; + ( + write_resolution_error + ) ob x; + Buffer.add_char ob ']' ) -let string_of_error_severity ?(len = 1024) x = +let string_of_error_type ?(len = 1024) x = let ob = Buffer.create len in - write_error_severity ob x; + write_error_type ob x; Buffer.contents ob -let read_error_severity = ( +let read_error_type = ( fun p lb -> Yojson.Safe.read_space p lb; match Yojson.Safe.start_any_variant p lb with | `Edgy_bracket -> ( match Yojson.Safe.read_ident p lb with - | "error" -> + | "Lexical error" -> Yojson.Safe.read_space p lb; Yojson.Safe.read_gt p lb; - `Error - | "warn" -> + (LexicalError : error_type) + | "Syntax error" -> Yojson.Safe.read_space p lb; Yojson.Safe.read_gt p lb; - `Warning - | "info" -> + (ParseError : error_type) + | "Other syntax error" -> Yojson.Safe.read_space p lb; Yojson.Safe.read_gt p lb; - `Info - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Double_quote -> ( - match Yojson.Safe.finish_string p lb with - | "error" -> - `Error - | "warn" -> - `Warning - | "info" -> - `Info - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Square_bracket -> ( - match Atdgen_runtime.Oj_run.read_string p lb with - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) -) -let error_severity_of_string s = - read_error_severity (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__string_list_option = ( - Atdgen_runtime.Oj_run.write_std_option ( - write__string_list - ) -) -let string_of__string_list_option ?(len = 1024) x = - let ob = Buffer.create len in - write__string_list_option ob x; - Buffer.contents ob -let read__string_list_option = ( - fun p lb -> - Yojson.Safe.read_space p lb; - match Yojson.Safe.start_any_variant p lb with - | `Edgy_bracket -> ( - match Yojson.Safe.read_ident p lb with - | "None" -> + (OtherParseError : error_type) + | "AST builder error" -> Yojson.Safe.read_space p lb; Yojson.Safe.read_gt p lb; - (None : _ option) - | "Some" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read__string_list - ) p lb - in + (AstBuilderError : error_type) + | "Rule parse error" -> Yojson.Safe.read_space p lb; Yojson.Safe.read_gt p lb; - (Some x : _ option) - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Double_quote -> ( - match Yojson.Safe.finish_string p lb with - | "None" -> - (None : _ option) - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Square_bracket -> ( - match Atdgen_runtime.Oj_run.read_string p lb with - | "Some" -> + (RuleParseError : error_type) + | "SemgrepWarning" -> Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; + Yojson.Safe.read_gt p lb; + (SemgrepWarning : error_type) + | "SemgrepError" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (SemgrepError : error_type) + | "InvalidRuleSchemaError" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (InvalidRuleSchemaError : error_type) + | "UnknownLanguageError" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (UnknownLanguageError : error_type) + | "Invalid YAML" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (InvalidYaml : error_type) + | "Internal matching error" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (MatchingError : error_type) + | "Semgrep match found" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (SemgrepMatchFound : error_type) + | "Too many matches" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (TooManyMatches : error_type) + | "Fatal error" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (FatalError : error_type) + | "Timeout" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (Timeout : error_type) + | "Out of memory" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (OutOfMemory : error_type) + | "Stack overflow" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (StackOverflow : error_type) + | "Timeout during interfile analysis" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (TimeoutDuringInterfile : error_type) + | "OOM during interfile analysis" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (OutOfMemoryDuringInterfile : error_type) + | "Missing plugin" -> Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (MissingPlugin : error_type) + | "PatternParseError" -> + Atdgen_runtime.Oj_run.read_until_field_value p lb; let x = ( read__string_list ) p lb in Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - (Some x : _ option) - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) -) -let _string_list_option_of_string s = - read__string_list_option (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__sca_info_option = ( - Atdgen_runtime.Oj_run.write_std_option ( - write_sca_info - ) -) -let string_of__sca_info_option ?(len = 1024) x = - let ob = Buffer.create len in - write__sca_info_option ob x; - Buffer.contents ob -let read__sca_info_option = ( - fun p lb -> - Yojson.Safe.read_space p lb; - match Yojson.Safe.start_any_variant p lb with - | `Edgy_bracket -> ( - match Yojson.Safe.read_ident p lb with - | "None" -> + Yojson.Safe.read_gt p lb; + (PatternParseError x : error_type) + | "PartialParsing" -> + Atdgen_runtime.Oj_run.read_until_field_value p lb; + let x = ( + read__location_list + ) p lb + in Yojson.Safe.read_space p lb; Yojson.Safe.read_gt p lb; - (None : _ option) - | "Some" -> + (PartialParsing x : error_type) + | "IncompatibleRule" -> Atdgen_runtime.Oj_run.read_until_field_value p lb; let x = ( - read_sca_info + read_incompatible_rule ) p lb in Yojson.Safe.read_space p lb; Yojson.Safe.read_gt p lb; - (Some x : _ option) + (IncompatibleRule x : error_type) + | "Pattern parse error" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (PatternParseError0 : error_type) + | "Incompatible rule" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (IncompatibleRule0 : error_type) + | "DependencyResolutionError" -> + Atdgen_runtime.Oj_run.read_until_field_value p lb; + let x = ( + read_resolution_error + ) p lb + in + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (DependencyResolutionError x : error_type) | x -> Atdgen_runtime.Oj_run.invalid_variant_tag p x ) | `Double_quote -> ( match Yojson.Safe.finish_string p lb with - | "None" -> - (None : _ option) + | "Lexical error" -> + (LexicalError : error_type) + | "Syntax error" -> + (ParseError : error_type) + | "Other syntax error" -> + (OtherParseError : error_type) + | "AST builder error" -> + (AstBuilderError : error_type) + | "Rule parse error" -> + (RuleParseError : error_type) + | "SemgrepWarning" -> + (SemgrepWarning : error_type) + | "SemgrepError" -> + (SemgrepError : error_type) + | "InvalidRuleSchemaError" -> + (InvalidRuleSchemaError : error_type) + | "UnknownLanguageError" -> + (UnknownLanguageError : error_type) + | "Invalid YAML" -> + (InvalidYaml : error_type) + | "Internal matching error" -> + (MatchingError : error_type) + | "Semgrep match found" -> + (SemgrepMatchFound : error_type) + | "Too many matches" -> + (TooManyMatches : error_type) + | "Fatal error" -> + (FatalError : error_type) + | "Timeout" -> + (Timeout : error_type) + | "Out of memory" -> + (OutOfMemory : error_type) + | "Stack overflow" -> + (StackOverflow : error_type) + | "Timeout during interfile analysis" -> + (TimeoutDuringInterfile : error_type) + | "OOM during interfile analysis" -> + (OutOfMemoryDuringInterfile : error_type) + | "Missing plugin" -> + (MissingPlugin : error_type) + | "Pattern parse error" -> + (PatternParseError0 : error_type) + | "Incompatible rule" -> + (IncompatibleRule0 : error_type) | x -> Atdgen_runtime.Oj_run.invalid_variant_tag p x ) | `Square_bracket -> ( match Atdgen_runtime.Oj_run.read_string p lb with - | "Some" -> + | "PatternParseError" -> Yojson.Safe.read_space p lb; Yojson.Safe.read_comma p lb; Yojson.Safe.read_space p lb; let x = ( - read_sca_info + read__string_list ) p lb in Yojson.Safe.read_space p lb; Yojson.Safe.read_rbr p lb; - (Some x : _ option) + (PatternParseError x : error_type) + | "PartialParsing" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_comma p lb; + Yojson.Safe.read_space p lb; + let x = ( + read__location_list + ) p lb + in + Yojson.Safe.read_space p lb; + Yojson.Safe.read_rbr p lb; + (PartialParsing x : error_type) + | "IncompatibleRule" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_comma p lb; + Yojson.Safe.read_space p lb; + let x = ( + read_incompatible_rule + ) p lb + in + Yojson.Safe.read_space p lb; + Yojson.Safe.read_rbr p lb; + (IncompatibleRule x : error_type) + | "DependencyResolutionError" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_comma p lb; + Yojson.Safe.read_space p lb; + let x = ( + read_resolution_error + ) p lb + in + Yojson.Safe.read_space p lb; + Yojson.Safe.read_rbr p lb; + (DependencyResolutionError x : error_type) | x -> Atdgen_runtime.Oj_run.invalid_variant_tag p x ) ) -let _sca_info_option_of_string s = - read__sca_info_option (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__metavars_option = ( +let error_type_of_string s = + read_error_type (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write__string_list_nullable = ( + Atdgen_runtime.Oj_run.write_nullable ( + write__string_list + ) +) +let string_of__string_list_nullable ?(len = 1024) x = + let ob = Buffer.create len in + write__string_list_nullable ob x; + Buffer.contents ob +let read__string_list_nullable = ( + fun p lb -> + Yojson.Safe.read_space p lb; + (if Yojson.Safe.read_null_if_possible p lb then None + else Some (( + read__string_list + ) p lb) : _ option) +) +let _string_list_nullable_of_string s = + read__string_list_nullable (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write__string_list_nullable_option = ( Atdgen_runtime.Oj_run.write_std_option ( - write_metavars + write__string_list_nullable ) ) -let string_of__metavars_option ?(len = 1024) x = +let string_of__string_list_nullable_option ?(len = 1024) x = let ob = Buffer.create len in - write__metavars_option ob x; + write__string_list_nullable_option ob x; Buffer.contents ob -let read__metavars_option = ( +let read__string_list_nullable_option = ( fun p lb -> Yojson.Safe.read_space p lb; match Yojson.Safe.start_any_variant p lb with @@ -18749,7 +18234,7 @@ let read__metavars_option = ( | "Some" -> Atdgen_runtime.Oj_run.read_until_field_value p lb; let x = ( - read_metavars + read__string_list_nullable ) p lb in Yojson.Safe.read_space p lb; @@ -18772,7 +18257,7 @@ let read__metavars_option = ( Yojson.Safe.read_comma p lb; Yojson.Safe.read_space p lb; let x = ( - read_metavars + read__string_list_nullable ) p lb in Yojson.Safe.read_space p lb; @@ -18782,18 +18267,37 @@ let read__metavars_option = ( Atdgen_runtime.Oj_run.invalid_variant_tag p x ) ) -let _metavars_option_of_string s = - read__metavars_option (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__engine_of_finding_option = ( - Atdgen_runtime.Oj_run.write_std_option ( - write_engine_of_finding +let _string_list_nullable_option_of_string s = + read__string_list_nullable_option (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write__position_nullable = ( + Atdgen_runtime.Oj_run.write_nullable ( + write_position ) ) -let string_of__engine_of_finding_option ?(len = 1024) x = +let string_of__position_nullable ?(len = 1024) x = let ob = Buffer.create len in - write__engine_of_finding_option ob x; + write__position_nullable ob x; Buffer.contents ob -let read__engine_of_finding_option = ( +let read__position_nullable = ( + fun p lb -> + Yojson.Safe.read_space p lb; + (if Yojson.Safe.read_null_if_possible p lb then None + else Some (( + read_position + ) p lb) : _ option) +) +let _position_nullable_of_string s = + read__position_nullable (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write__position_nullable_option = ( + Atdgen_runtime.Oj_run.write_std_option ( + write__position_nullable + ) +) +let string_of__position_nullable_option ?(len = 1024) x = + let ob = Buffer.create len in + write__position_nullable_option ob x; + Buffer.contents ob +let read__position_nullable_option = ( fun p lb -> Yojson.Safe.read_space p lb; match Yojson.Safe.start_any_variant p lb with @@ -18806,7 +18310,7 @@ let read__engine_of_finding_option = ( | "Some" -> Atdgen_runtime.Oj_run.read_until_field_value p lb; let x = ( - read_engine_of_finding + read__position_nullable ) p lb in Yojson.Safe.read_space p lb; @@ -18829,7 +18333,7 @@ let read__engine_of_finding_option = ( Yojson.Safe.read_comma p lb; Yojson.Safe.read_space p lb; let x = ( - read_engine_of_finding + read__position_nullable ) p lb in Yojson.Safe.read_space p lb; @@ -18839,192 +18343,124 @@ let read__engine_of_finding_option = ( Atdgen_runtime.Oj_run.invalid_variant_tag p x ) ) -let _engine_of_finding_option_of_string s = - read__engine_of_finding_option (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_cli_match_extra : _ -> cli_match_extra -> _ = ( - fun ob (x : cli_match_extra) -> +let _position_nullable_option_of_string s = + read__position_nullable_option (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_error_span : _ -> error_span -> _ = ( + fun ob (x : error_span) -> Buffer.add_char ob '{'; let is_first = ref true in - (match x.metavars with None -> () | Some x -> - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"metavars\":"; - ( - write_metavars - ) - ob x; - ); - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"message\":"; - ( - Yojson.Safe.write_string - ) - ob x.message; - (match x.fix with None -> () | Some x -> - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"fix\":"; - ( - Yojson.Safe.write_string - ) - ob x; - ); - (match x.fixed_lines with None -> () | Some x -> - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"fixed_lines\":"; - ( - write__string_list - ) - ob x; - ); - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"metadata\":"; - ( - write_raw_json - ) - ob x.metadata; if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"severity\":"; + Buffer.add_string ob "\"file\":"; ( - write_match_severity + write_fpath ) - ob x.severity; + ob x.file; if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"fingerprint\":"; + Buffer.add_string ob "\"start\":"; ( - Yojson.Safe.write_string + write_position ) - ob x.fingerprint; + ob x.start; if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"lines\":"; + Buffer.add_string ob "\"end\":"; ( - Yojson.Safe.write_string + write_position ) - ob x.lines; - (match x.is_ignored with None -> () | Some x -> - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"is_ignored\":"; - ( - Yojson.Safe.write_bool - ) - ob x; - ); - (match x.sca_info with None -> () | Some x -> + ob x.end_; + (match x.source_hash with None -> () | Some x -> if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"sca_info\":"; + Buffer.add_string ob "\"source_hash\":"; ( - write_sca_info + Yojson.Safe.write_string ) ob x; ); - (match x.dataflow_trace with None -> () | Some x -> + (match x.config_start with None -> () | Some x -> if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"dataflow_trace\":"; + Buffer.add_string ob "\"config_start\":"; ( - write_match_dataflow_trace + write__position_nullable ) ob x; ); - (match x.engine_kind with None -> () | Some x -> + (match x.config_end with None -> () | Some x -> if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"engine_kind\":"; + Buffer.add_string ob "\"config_end\":"; ( - write_engine_of_finding + write__position_nullable ) ob x; ); - (match x.validation_state with None -> () | Some x -> + (match x.config_path with None -> () | Some x -> if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"validation_state\":"; + Buffer.add_string ob "\"config_path\":"; ( - write_validation_state + write__string_list_nullable ) ob x; ); - (match x.historical_info with None -> () | Some x -> + (match x.context_start with None -> () | Some x -> if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"historical_info\":"; + Buffer.add_string ob "\"context_start\":"; ( - write_historical_info + write__position_nullable ) ob x; ); - (match x.extra_extra with None -> () | Some x -> + (match x.context_end with None -> () | Some x -> if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"extra_extra\":"; + Buffer.add_string ob "\"context_end\":"; ( - write_raw_json + write__position_nullable ) ob x; ); Buffer.add_char ob '}'; ) -let string_of_cli_match_extra ?(len = 1024) x = +let string_of_error_span ?(len = 1024) x = let ob = Buffer.create len in - write_cli_match_extra ob x; + write_error_span ob x; Buffer.contents ob -let read_cli_match_extra = ( +let read_error_span = ( fun p lb -> Yojson.Safe.read_space p lb; Yojson.Safe.read_lcurl p lb; - let field_metavars = ref (None) in - let field_message = ref (None) in - let field_fix = ref (None) in - let field_fixed_lines = ref (None) in - let field_metadata = ref (None) in - let field_severity = ref (None) in - let field_fingerprint = ref (None) in - let field_lines = ref (None) in - let field_is_ignored = ref (None) in - let field_sca_info = ref (None) in - let field_dataflow_trace = ref (None) in - let field_engine_kind = ref (None) in - let field_validation_state = ref (None) in - let field_historical_info = ref (None) in - let field_extra_extra = ref (None) in + let field_file = ref (None) in + let field_start = ref (None) in + let field_end_ = ref (None) in + let field_source_hash = ref (None) in + let field_config_start = ref (None) in + let field_config_end = ref (None) in + let field_config_path = ref (None) in + let field_context_start = ref (None) in + let field_context_end = ref (None) in try Yojson.Safe.read_space p lb; Yojson.Safe.read_object_end lb; @@ -19035,45 +18471,53 @@ let read_cli_match_extra = ( invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); match len with | 3 -> ( - if String.unsafe_get s pos = 'f' && String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = 'x' then ( + if String.unsafe_get s pos = 'e' && String.unsafe_get s (pos+1) = 'n' && String.unsafe_get s (pos+2) = 'd' then ( 2 ) else ( -1 ) ) - | 5 -> ( - if String.unsafe_get s pos = 'l' && String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = 's' then ( - 7 + | 4 -> ( + if String.unsafe_get s pos = 'f' && String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = 'l' && String.unsafe_get s (pos+3) = 'e' then ( + 0 ) else ( -1 ) ) - | 7 -> ( - if String.unsafe_get s pos = 'm' && String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 's' && String.unsafe_get s (pos+3) = 's' && String.unsafe_get s (pos+4) = 'a' && String.unsafe_get s (pos+5) = 'g' && String.unsafe_get s (pos+6) = 'e' then ( + | 5 -> ( + if String.unsafe_get s pos = 's' && String.unsafe_get s (pos+1) = 't' && String.unsafe_get s (pos+2) = 'a' && String.unsafe_get s (pos+3) = 'r' && String.unsafe_get s (pos+4) = 't' then ( 1 ) else ( -1 ) ) - | 8 -> ( + | 10 -> ( + if String.unsafe_get s pos = 'c' && String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = 'f' && String.unsafe_get s (pos+4) = 'i' && String.unsafe_get s (pos+5) = 'g' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 'e' && String.unsafe_get s (pos+8) = 'n' && String.unsafe_get s (pos+9) = 'd' then ( + 5 + ) + else ( + -1 + ) + ) + | 11 -> ( match String.unsafe_get s pos with - | 'm' -> ( - if String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'a' then ( - match String.unsafe_get s (pos+4) with - | 'd' -> ( - if String.unsafe_get s (pos+5) = 'a' && String.unsafe_get s (pos+6) = 't' && String.unsafe_get s (pos+7) = 'a' then ( - 4 + | 'c' -> ( + if String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'n' then ( + match String.unsafe_get s (pos+3) with + | 'f' -> ( + if String.unsafe_get s (pos+4) = 'i' && String.unsafe_get s (pos+5) = 'g' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 'p' && String.unsafe_get s (pos+8) = 'a' && String.unsafe_get s (pos+9) = 't' && String.unsafe_get s (pos+10) = 'h' then ( + 6 ) else ( -1 ) ) - | 'v' -> ( - if String.unsafe_get s (pos+5) = 'a' && String.unsafe_get s (pos+6) = 'r' && String.unsafe_get s (pos+7) = 's' then ( - 0 + | 't' -> ( + if String.unsafe_get s (pos+4) = 'e' && String.unsafe_get s (pos+5) = 'x' && String.unsafe_get s (pos+6) = 't' && String.unsafe_get s (pos+7) = '_' && String.unsafe_get s (pos+8) = 'e' && String.unsafe_get s (pos+9) = 'n' && String.unsafe_get s (pos+10) = 'd' then ( + 8 ) else ( -1 @@ -19088,113 +18532,28 @@ let read_cli_match_extra = ( ) ) | 's' -> ( - match String.unsafe_get s (pos+1) with - | 'c' -> ( - if String.unsafe_get s (pos+2) = 'a' && String.unsafe_get s (pos+3) = '_' && String.unsafe_get s (pos+4) = 'i' && String.unsafe_get s (pos+5) = 'n' && String.unsafe_get s (pos+6) = 'f' && String.unsafe_get s (pos+7) = 'o' then ( - 9 - ) - else ( - -1 - ) - ) - | 'e' -> ( - if String.unsafe_get s (pos+2) = 'v' && String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = 'r' && String.unsafe_get s (pos+5) = 'i' && String.unsafe_get s (pos+6) = 't' && String.unsafe_get s (pos+7) = 'y' then ( - 5 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) + if String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'u' && String.unsafe_get s (pos+3) = 'r' && String.unsafe_get s (pos+4) = 'c' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 'h' && String.unsafe_get s (pos+8) = 'a' && String.unsafe_get s (pos+9) = 's' && String.unsafe_get s (pos+10) = 'h' then ( + 3 + ) + else ( + -1 + ) ) | _ -> ( -1 ) ) - | 10 -> ( - if String.unsafe_get s pos = 'i' && String.unsafe_get s (pos+1) = 's' && String.unsafe_get s (pos+2) = '_' && String.unsafe_get s (pos+3) = 'i' && String.unsafe_get s (pos+4) = 'g' && String.unsafe_get s (pos+5) = 'n' && String.unsafe_get s (pos+6) = 'o' && String.unsafe_get s (pos+7) = 'r' && String.unsafe_get s (pos+8) = 'e' && String.unsafe_get s (pos+9) = 'd' then ( - 8 + | 12 -> ( + if String.unsafe_get s pos = 'c' && String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = 'f' && String.unsafe_get s (pos+4) = 'i' && String.unsafe_get s (pos+5) = 'g' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 's' && String.unsafe_get s (pos+8) = 't' && String.unsafe_get s (pos+9) = 'a' && String.unsafe_get s (pos+10) = 'r' && String.unsafe_get s (pos+11) = 't' then ( + 4 ) else ( -1 ) ) - | 11 -> ( - match String.unsafe_get s pos with - | 'e' -> ( - match String.unsafe_get s (pos+1) with - | 'n' -> ( - if String.unsafe_get s (pos+2) = 'g' && String.unsafe_get s (pos+3) = 'i' && String.unsafe_get s (pos+4) = 'n' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 'k' && String.unsafe_get s (pos+8) = 'i' && String.unsafe_get s (pos+9) = 'n' && String.unsafe_get s (pos+10) = 'd' then ( - 11 - ) - else ( - -1 - ) - ) - | 'x' -> ( - if String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'r' && String.unsafe_get s (pos+4) = 'a' && String.unsafe_get s (pos+5) = '_' && String.unsafe_get s (pos+6) = 'e' && String.unsafe_get s (pos+7) = 'x' && String.unsafe_get s (pos+8) = 't' && String.unsafe_get s (pos+9) = 'r' && String.unsafe_get s (pos+10) = 'a' then ( - 14 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - ) - | 'f' -> ( - if String.unsafe_get s (pos+1) = 'i' then ( - match String.unsafe_get s (pos+2) with - | 'n' -> ( - if String.unsafe_get s (pos+3) = 'g' && String.unsafe_get s (pos+4) = 'e' && String.unsafe_get s (pos+5) = 'r' && String.unsafe_get s (pos+6) = 'p' && String.unsafe_get s (pos+7) = 'r' && String.unsafe_get s (pos+8) = 'i' && String.unsafe_get s (pos+9) = 'n' && String.unsafe_get s (pos+10) = 't' then ( - 6 - ) - else ( - -1 - ) - ) - | 'x' -> ( - if String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = 'd' && String.unsafe_get s (pos+5) = '_' && String.unsafe_get s (pos+6) = 'l' && String.unsafe_get s (pos+7) = 'i' && String.unsafe_get s (pos+8) = 'n' && String.unsafe_get s (pos+9) = 'e' && String.unsafe_get s (pos+10) = 's' then ( - 3 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - ) - | 14 -> ( - if String.unsafe_get s pos = 'd' && String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'a' && String.unsafe_get s (pos+4) = 'f' && String.unsafe_get s (pos+5) = 'l' && String.unsafe_get s (pos+6) = 'o' && String.unsafe_get s (pos+7) = 'w' && String.unsafe_get s (pos+8) = '_' && String.unsafe_get s (pos+9) = 't' && String.unsafe_get s (pos+10) = 'r' && String.unsafe_get s (pos+11) = 'a' && String.unsafe_get s (pos+12) = 'c' && String.unsafe_get s (pos+13) = 'e' then ( - 10 - ) - else ( - -1 - ) - ) - | 15 -> ( - if String.unsafe_get s pos = 'h' && String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = 's' && String.unsafe_get s (pos+3) = 't' && String.unsafe_get s (pos+4) = 'o' && String.unsafe_get s (pos+5) = 'r' && String.unsafe_get s (pos+6) = 'i' && String.unsafe_get s (pos+7) = 'c' && String.unsafe_get s (pos+8) = 'a' && String.unsafe_get s (pos+9) = 'l' && String.unsafe_get s (pos+10) = '_' && String.unsafe_get s (pos+11) = 'i' && String.unsafe_get s (pos+12) = 'n' && String.unsafe_get s (pos+13) = 'f' && String.unsafe_get s (pos+14) = 'o' then ( - 13 - ) - else ( - -1 - ) - ) - | 16 -> ( - if String.unsafe_get s pos = 'v' && String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 'l' && String.unsafe_get s (pos+3) = 'i' && String.unsafe_get s (pos+4) = 'd' && String.unsafe_get s (pos+5) = 'a' && String.unsafe_get s (pos+6) = 't' && String.unsafe_get s (pos+7) = 'i' && String.unsafe_get s (pos+8) = 'o' && String.unsafe_get s (pos+9) = 'n' && String.unsafe_get s (pos+10) = '_' && String.unsafe_get s (pos+11) = 's' && String.unsafe_get s (pos+12) = 't' && String.unsafe_get s (pos+13) = 'a' && String.unsafe_get s (pos+14) = 't' && String.unsafe_get s (pos+15) = 'e' then ( - 12 + | 13 -> ( + if String.unsafe_get s pos = 'c' && String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = 't' && String.unsafe_get s (pos+4) = 'e' && String.unsafe_get s (pos+5) = 'x' && String.unsafe_get s (pos+6) = 't' && String.unsafe_get s (pos+7) = '_' && String.unsafe_get s (pos+8) = 's' && String.unsafe_get s (pos+9) = 't' && String.unsafe_get s (pos+10) = 'a' && String.unsafe_get s (pos+11) = 'r' && String.unsafe_get s (pos+12) = 't' then ( + 7 ) else ( -1 @@ -19209,141 +18568,85 @@ let read_cli_match_extra = ( ( match i with | 0 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_metavars := ( - Some ( - ( - read_metavars - ) p lb - ) - ); - ) - | 1 -> - field_message := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_string - ) p lb - ) - ); - | 2 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_fix := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_string - ) p lb - ) - ); - ) - | 3 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_fixed_lines := ( - Some ( - ( - read__string_list - ) p lb - ) - ); - ) - | 4 -> - field_metadata := ( - Some ( - ( - read_raw_json - ) p lb - ) - ); - | 5 -> - field_severity := ( + field_file := ( Some ( ( - read_match_severity + read_fpath ) p lb ) ); - | 6 -> - field_fingerprint := ( + | 1 -> + field_start := ( Some ( ( - Atdgen_runtime.Oj_run.read_string + read_position ) p lb ) ); - | 7 -> - field_lines := ( + | 2 -> + field_end_ := ( Some ( ( - Atdgen_runtime.Oj_run.read_string + read_position ) p lb ) ); - | 8 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_is_ignored := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_bool - ) p lb - ) - ); - ) - | 9 -> + | 3 -> if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_sca_info := ( + field_source_hash := ( Some ( ( - read_sca_info + Atdgen_runtime.Oj_run.read_string ) p lb ) ); ) - | 10 -> + | 4 -> if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_dataflow_trace := ( + field_config_start := ( Some ( ( - read_match_dataflow_trace + read__position_nullable ) p lb ) ); ) - | 11 -> + | 5 -> if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_engine_kind := ( + field_config_end := ( Some ( ( - read_engine_of_finding + read__position_nullable ) p lb ) ); ) - | 12 -> + | 6 -> if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_validation_state := ( + field_config_path := ( Some ( ( - read_validation_state + read__string_list_nullable ) p lb ) ); ) - | 13 -> + | 7 -> if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_historical_info := ( + field_context_start := ( Some ( ( - read_historical_info + read__position_nullable ) p lb ) ); ) - | 14 -> + | 8 -> if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_extra_extra := ( + field_context_end := ( Some ( ( - read_raw_json + read__position_nullable ) p lb ) ); @@ -19362,45 +18665,53 @@ let read_cli_match_extra = ( invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); match len with | 3 -> ( - if String.unsafe_get s pos = 'f' && String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = 'x' then ( + if String.unsafe_get s pos = 'e' && String.unsafe_get s (pos+1) = 'n' && String.unsafe_get s (pos+2) = 'd' then ( 2 ) else ( -1 ) ) - | 5 -> ( - if String.unsafe_get s pos = 'l' && String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = 's' then ( - 7 + | 4 -> ( + if String.unsafe_get s pos = 'f' && String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = 'l' && String.unsafe_get s (pos+3) = 'e' then ( + 0 ) else ( -1 ) ) - | 7 -> ( - if String.unsafe_get s pos = 'm' && String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 's' && String.unsafe_get s (pos+3) = 's' && String.unsafe_get s (pos+4) = 'a' && String.unsafe_get s (pos+5) = 'g' && String.unsafe_get s (pos+6) = 'e' then ( + | 5 -> ( + if String.unsafe_get s pos = 's' && String.unsafe_get s (pos+1) = 't' && String.unsafe_get s (pos+2) = 'a' && String.unsafe_get s (pos+3) = 'r' && String.unsafe_get s (pos+4) = 't' then ( 1 ) else ( -1 ) ) - | 8 -> ( + | 10 -> ( + if String.unsafe_get s pos = 'c' && String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = 'f' && String.unsafe_get s (pos+4) = 'i' && String.unsafe_get s (pos+5) = 'g' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 'e' && String.unsafe_get s (pos+8) = 'n' && String.unsafe_get s (pos+9) = 'd' then ( + 5 + ) + else ( + -1 + ) + ) + | 11 -> ( match String.unsafe_get s pos with - | 'm' -> ( - if String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'a' then ( - match String.unsafe_get s (pos+4) with - | 'd' -> ( - if String.unsafe_get s (pos+5) = 'a' && String.unsafe_get s (pos+6) = 't' && String.unsafe_get s (pos+7) = 'a' then ( - 4 + | 'c' -> ( + if String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'n' then ( + match String.unsafe_get s (pos+3) with + | 'f' -> ( + if String.unsafe_get s (pos+4) = 'i' && String.unsafe_get s (pos+5) = 'g' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 'p' && String.unsafe_get s (pos+8) = 'a' && String.unsafe_get s (pos+9) = 't' && String.unsafe_get s (pos+10) = 'h' then ( + 6 ) else ( -1 ) ) - | 'v' -> ( - if String.unsafe_get s (pos+5) = 'a' && String.unsafe_get s (pos+6) = 'r' && String.unsafe_get s (pos+7) = 's' then ( - 0 + | 't' -> ( + if String.unsafe_get s (pos+4) = 'e' && String.unsafe_get s (pos+5) = 'x' && String.unsafe_get s (pos+6) = 't' && String.unsafe_get s (pos+7) = '_' && String.unsafe_get s (pos+8) = 'e' && String.unsafe_get s (pos+9) = 'n' && String.unsafe_get s (pos+10) = 'd' then ( + 8 ) else ( -1 @@ -19415,113 +18726,28 @@ let read_cli_match_extra = ( ) ) | 's' -> ( - match String.unsafe_get s (pos+1) with - | 'c' -> ( - if String.unsafe_get s (pos+2) = 'a' && String.unsafe_get s (pos+3) = '_' && String.unsafe_get s (pos+4) = 'i' && String.unsafe_get s (pos+5) = 'n' && String.unsafe_get s (pos+6) = 'f' && String.unsafe_get s (pos+7) = 'o' then ( - 9 - ) - else ( - -1 - ) - ) - | 'e' -> ( - if String.unsafe_get s (pos+2) = 'v' && String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = 'r' && String.unsafe_get s (pos+5) = 'i' && String.unsafe_get s (pos+6) = 't' && String.unsafe_get s (pos+7) = 'y' then ( - 5 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) + if String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'u' && String.unsafe_get s (pos+3) = 'r' && String.unsafe_get s (pos+4) = 'c' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 'h' && String.unsafe_get s (pos+8) = 'a' && String.unsafe_get s (pos+9) = 's' && String.unsafe_get s (pos+10) = 'h' then ( + 3 + ) + else ( + -1 + ) ) | _ -> ( -1 ) ) - | 10 -> ( - if String.unsafe_get s pos = 'i' && String.unsafe_get s (pos+1) = 's' && String.unsafe_get s (pos+2) = '_' && String.unsafe_get s (pos+3) = 'i' && String.unsafe_get s (pos+4) = 'g' && String.unsafe_get s (pos+5) = 'n' && String.unsafe_get s (pos+6) = 'o' && String.unsafe_get s (pos+7) = 'r' && String.unsafe_get s (pos+8) = 'e' && String.unsafe_get s (pos+9) = 'd' then ( - 8 + | 12 -> ( + if String.unsafe_get s pos = 'c' && String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = 'f' && String.unsafe_get s (pos+4) = 'i' && String.unsafe_get s (pos+5) = 'g' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 's' && String.unsafe_get s (pos+8) = 't' && String.unsafe_get s (pos+9) = 'a' && String.unsafe_get s (pos+10) = 'r' && String.unsafe_get s (pos+11) = 't' then ( + 4 ) else ( -1 ) ) - | 11 -> ( - match String.unsafe_get s pos with - | 'e' -> ( - match String.unsafe_get s (pos+1) with - | 'n' -> ( - if String.unsafe_get s (pos+2) = 'g' && String.unsafe_get s (pos+3) = 'i' && String.unsafe_get s (pos+4) = 'n' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 'k' && String.unsafe_get s (pos+8) = 'i' && String.unsafe_get s (pos+9) = 'n' && String.unsafe_get s (pos+10) = 'd' then ( - 11 - ) - else ( - -1 - ) - ) - | 'x' -> ( - if String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'r' && String.unsafe_get s (pos+4) = 'a' && String.unsafe_get s (pos+5) = '_' && String.unsafe_get s (pos+6) = 'e' && String.unsafe_get s (pos+7) = 'x' && String.unsafe_get s (pos+8) = 't' && String.unsafe_get s (pos+9) = 'r' && String.unsafe_get s (pos+10) = 'a' then ( - 14 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - ) - | 'f' -> ( - if String.unsafe_get s (pos+1) = 'i' then ( - match String.unsafe_get s (pos+2) with - | 'n' -> ( - if String.unsafe_get s (pos+3) = 'g' && String.unsafe_get s (pos+4) = 'e' && String.unsafe_get s (pos+5) = 'r' && String.unsafe_get s (pos+6) = 'p' && String.unsafe_get s (pos+7) = 'r' && String.unsafe_get s (pos+8) = 'i' && String.unsafe_get s (pos+9) = 'n' && String.unsafe_get s (pos+10) = 't' then ( - 6 - ) - else ( - -1 - ) - ) - | 'x' -> ( - if String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = 'd' && String.unsafe_get s (pos+5) = '_' && String.unsafe_get s (pos+6) = 'l' && String.unsafe_get s (pos+7) = 'i' && String.unsafe_get s (pos+8) = 'n' && String.unsafe_get s (pos+9) = 'e' && String.unsafe_get s (pos+10) = 's' then ( - 3 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - ) - | 14 -> ( - if String.unsafe_get s pos = 'd' && String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'a' && String.unsafe_get s (pos+4) = 'f' && String.unsafe_get s (pos+5) = 'l' && String.unsafe_get s (pos+6) = 'o' && String.unsafe_get s (pos+7) = 'w' && String.unsafe_get s (pos+8) = '_' && String.unsafe_get s (pos+9) = 't' && String.unsafe_get s (pos+10) = 'r' && String.unsafe_get s (pos+11) = 'a' && String.unsafe_get s (pos+12) = 'c' && String.unsafe_get s (pos+13) = 'e' then ( - 10 - ) - else ( - -1 - ) - ) - | 15 -> ( - if String.unsafe_get s pos = 'h' && String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = 's' && String.unsafe_get s (pos+3) = 't' && String.unsafe_get s (pos+4) = 'o' && String.unsafe_get s (pos+5) = 'r' && String.unsafe_get s (pos+6) = 'i' && String.unsafe_get s (pos+7) = 'c' && String.unsafe_get s (pos+8) = 'a' && String.unsafe_get s (pos+9) = 'l' && String.unsafe_get s (pos+10) = '_' && String.unsafe_get s (pos+11) = 'i' && String.unsafe_get s (pos+12) = 'n' && String.unsafe_get s (pos+13) = 'f' && String.unsafe_get s (pos+14) = 'o' then ( - 13 - ) - else ( - -1 - ) - ) - | 16 -> ( - if String.unsafe_get s pos = 'v' && String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 'l' && String.unsafe_get s (pos+3) = 'i' && String.unsafe_get s (pos+4) = 'd' && String.unsafe_get s (pos+5) = 'a' && String.unsafe_get s (pos+6) = 't' && String.unsafe_get s (pos+7) = 'i' && String.unsafe_get s (pos+8) = 'o' && String.unsafe_get s (pos+9) = 'n' && String.unsafe_get s (pos+10) = '_' && String.unsafe_get s (pos+11) = 's' && String.unsafe_get s (pos+12) = 't' && String.unsafe_get s (pos+13) = 'a' && String.unsafe_get s (pos+14) = 't' && String.unsafe_get s (pos+15) = 'e' then ( - 12 + | 13 -> ( + if String.unsafe_get s pos = 'c' && String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = 't' && String.unsafe_get s (pos+4) = 'e' && String.unsafe_get s (pos+5) = 'x' && String.unsafe_get s (pos+6) = 't' && String.unsafe_get s (pos+7) = '_' && String.unsafe_get s (pos+8) = 's' && String.unsafe_get s (pos+9) = 't' && String.unsafe_get s (pos+10) = 'a' && String.unsafe_get s (pos+11) = 'r' && String.unsafe_get s (pos+12) = 't' then ( + 7 ) else ( -1 @@ -19536,141 +18762,85 @@ let read_cli_match_extra = ( ( match i with | 0 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_metavars := ( - Some ( - ( - read_metavars - ) p lb - ) - ); - ) - | 1 -> - field_message := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_string - ) p lb - ) - ); - | 2 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_fix := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_string - ) p lb - ) - ); - ) - | 3 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_fixed_lines := ( - Some ( - ( - read__string_list - ) p lb - ) - ); - ) - | 4 -> - field_metadata := ( - Some ( - ( - read_raw_json - ) p lb - ) - ); - | 5 -> - field_severity := ( + field_file := ( Some ( ( - read_match_severity + read_fpath ) p lb ) ); - | 6 -> - field_fingerprint := ( + | 1 -> + field_start := ( Some ( ( - Atdgen_runtime.Oj_run.read_string + read_position ) p lb ) ); - | 7 -> - field_lines := ( + | 2 -> + field_end_ := ( Some ( ( - Atdgen_runtime.Oj_run.read_string + read_position ) p lb ) ); - | 8 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_is_ignored := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_bool - ) p lb - ) - ); - ) - | 9 -> + | 3 -> if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_sca_info := ( + field_source_hash := ( Some ( ( - read_sca_info + Atdgen_runtime.Oj_run.read_string ) p lb ) ); ) - | 10 -> + | 4 -> if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_dataflow_trace := ( + field_config_start := ( Some ( ( - read_match_dataflow_trace + read__position_nullable ) p lb ) ); ) - | 11 -> + | 5 -> if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_engine_kind := ( + field_config_end := ( Some ( ( - read_engine_of_finding + read__position_nullable ) p lb ) ); ) - | 12 -> + | 6 -> if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_validation_state := ( + field_config_path := ( Some ( ( - read_validation_state + read__string_list_nullable ) p lb ) ); ) - | 13 -> + | 7 -> if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_historical_info := ( + field_context_start := ( Some ( ( - read_historical_info + read__position_nullable ) p lb ) ); ) - | 14 -> + | 8 -> if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_extra_extra := ( + field_context_end := ( Some ( ( - read_raw_json + read__position_nullable ) p lb ) ); @@ -19684,91 +18854,484 @@ let read_cli_match_extra = ( with Yojson.End_of_object -> ( ( { - metavars = !field_metavars; - message = (match !field_message with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "message"); - fix = !field_fix; - fixed_lines = !field_fixed_lines; - metadata = (match !field_metadata with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "metadata"); - severity = (match !field_severity with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "severity"); - fingerprint = (match !field_fingerprint with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "fingerprint"); - lines = (match !field_lines with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "lines"); - is_ignored = !field_is_ignored; - sca_info = !field_sca_info; - dataflow_trace = !field_dataflow_trace; - engine_kind = !field_engine_kind; - validation_state = !field_validation_state; - historical_info = !field_historical_info; - extra_extra = !field_extra_extra; + file = (match !field_file with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "file"); + start = (match !field_start with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "start"); + end_ = (match !field_end_ with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "end_"); + source_hash = !field_source_hash; + config_start = !field_config_start; + config_end = !field_config_end; + config_path = !field_config_path; + context_start = !field_context_start; + context_end = !field_context_end; } - : cli_match_extra) + : error_span) ) ) -let cli_match_extra_of_string s = - read_cli_match_extra (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_cli_match : _ -> cli_match -> _ = ( - fun ob (x : cli_match) -> - Buffer.add_char ob '{'; - let is_first = ref true in - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"check_id\":"; - ( - write_rule_id - ) - ob x.check_id; - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"path\":"; - ( - write_fpath - ) - ob x.path; - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"start\":"; - ( - write_position - ) - ob x.start; - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"end\":"; - ( - write_position - ) - ob x.end_; - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"extra\":"; - ( - write_cli_match_extra +let error_span_of_string s = + read_error_span (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_error_severity = ( + fun ob x -> + match x with + | `Error -> Buffer.add_string ob "\"error\"" + | `Warning -> Buffer.add_string ob "\"warn\"" + | `Info -> Buffer.add_string ob "\"info\"" +) +let string_of_error_severity ?(len = 1024) x = + let ob = Buffer.create len in + write_error_severity ob x; + Buffer.contents ob +let read_error_severity = ( + fun p lb -> + Yojson.Safe.read_space p lb; + match Yojson.Safe.start_any_variant p lb with + | `Edgy_bracket -> ( + match Yojson.Safe.read_ident p lb with + | "error" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + `Error + | "warn" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + `Warning + | "info" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + `Info + | x -> + Atdgen_runtime.Oj_run.invalid_variant_tag p x + ) + | `Double_quote -> ( + match Yojson.Safe.finish_string p lb with + | "error" -> + `Error + | "warn" -> + `Warning + | "info" -> + `Info + | x -> + Atdgen_runtime.Oj_run.invalid_variant_tag p x + ) + | `Square_bracket -> ( + match Atdgen_runtime.Oj_run.read_string p lb with + | x -> + Atdgen_runtime.Oj_run.invalid_variant_tag p x + ) +) +let error_severity_of_string s = + read_error_severity (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write__string_list_option = ( + Atdgen_runtime.Oj_run.write_std_option ( + write__string_list + ) +) +let string_of__string_list_option ?(len = 1024) x = + let ob = Buffer.create len in + write__string_list_option ob x; + Buffer.contents ob +let read__string_list_option = ( + fun p lb -> + Yojson.Safe.read_space p lb; + match Yojson.Safe.start_any_variant p lb with + | `Edgy_bracket -> ( + match Yojson.Safe.read_ident p lb with + | "None" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (None : _ option) + | "Some" -> + Atdgen_runtime.Oj_run.read_until_field_value p lb; + let x = ( + read__string_list + ) p lb + in + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (Some x : _ option) + | x -> + Atdgen_runtime.Oj_run.invalid_variant_tag p x + ) + | `Double_quote -> ( + match Yojson.Safe.finish_string p lb with + | "None" -> + (None : _ option) + | x -> + Atdgen_runtime.Oj_run.invalid_variant_tag p x + ) + | `Square_bracket -> ( + match Atdgen_runtime.Oj_run.read_string p lb with + | "Some" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_comma p lb; + Yojson.Safe.read_space p lb; + let x = ( + read__string_list + ) p lb + in + Yojson.Safe.read_space p lb; + Yojson.Safe.read_rbr p lb; + (Some x : _ option) + | x -> + Atdgen_runtime.Oj_run.invalid_variant_tag p x + ) +) +let _string_list_option_of_string s = + read__string_list_option (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write__sca_info_option = ( + Atdgen_runtime.Oj_run.write_std_option ( + write_sca_info + ) +) +let string_of__sca_info_option ?(len = 1024) x = + let ob = Buffer.create len in + write__sca_info_option ob x; + Buffer.contents ob +let read__sca_info_option = ( + fun p lb -> + Yojson.Safe.read_space p lb; + match Yojson.Safe.start_any_variant p lb with + | `Edgy_bracket -> ( + match Yojson.Safe.read_ident p lb with + | "None" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (None : _ option) + | "Some" -> + Atdgen_runtime.Oj_run.read_until_field_value p lb; + let x = ( + read_sca_info + ) p lb + in + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (Some x : _ option) + | x -> + Atdgen_runtime.Oj_run.invalid_variant_tag p x + ) + | `Double_quote -> ( + match Yojson.Safe.finish_string p lb with + | "None" -> + (None : _ option) + | x -> + Atdgen_runtime.Oj_run.invalid_variant_tag p x + ) + | `Square_bracket -> ( + match Atdgen_runtime.Oj_run.read_string p lb with + | "Some" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_comma p lb; + Yojson.Safe.read_space p lb; + let x = ( + read_sca_info + ) p lb + in + Yojson.Safe.read_space p lb; + Yojson.Safe.read_rbr p lb; + (Some x : _ option) + | x -> + Atdgen_runtime.Oj_run.invalid_variant_tag p x + ) +) +let _sca_info_option_of_string s = + read__sca_info_option (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write__metavars_option = ( + Atdgen_runtime.Oj_run.write_std_option ( + write_metavars + ) +) +let string_of__metavars_option ?(len = 1024) x = + let ob = Buffer.create len in + write__metavars_option ob x; + Buffer.contents ob +let read__metavars_option = ( + fun p lb -> + Yojson.Safe.read_space p lb; + match Yojson.Safe.start_any_variant p lb with + | `Edgy_bracket -> ( + match Yojson.Safe.read_ident p lb with + | "None" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (None : _ option) + | "Some" -> + Atdgen_runtime.Oj_run.read_until_field_value p lb; + let x = ( + read_metavars + ) p lb + in + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (Some x : _ option) + | x -> + Atdgen_runtime.Oj_run.invalid_variant_tag p x + ) + | `Double_quote -> ( + match Yojson.Safe.finish_string p lb with + | "None" -> + (None : _ option) + | x -> + Atdgen_runtime.Oj_run.invalid_variant_tag p x + ) + | `Square_bracket -> ( + match Atdgen_runtime.Oj_run.read_string p lb with + | "Some" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_comma p lb; + Yojson.Safe.read_space p lb; + let x = ( + read_metavars + ) p lb + in + Yojson.Safe.read_space p lb; + Yojson.Safe.read_rbr p lb; + (Some x : _ option) + | x -> + Atdgen_runtime.Oj_run.invalid_variant_tag p x + ) +) +let _metavars_option_of_string s = + read__metavars_option (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write__engine_of_finding_option = ( + Atdgen_runtime.Oj_run.write_std_option ( + write_engine_of_finding + ) +) +let string_of__engine_of_finding_option ?(len = 1024) x = + let ob = Buffer.create len in + write__engine_of_finding_option ob x; + Buffer.contents ob +let read__engine_of_finding_option = ( + fun p lb -> + Yojson.Safe.read_space p lb; + match Yojson.Safe.start_any_variant p lb with + | `Edgy_bracket -> ( + match Yojson.Safe.read_ident p lb with + | "None" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (None : _ option) + | "Some" -> + Atdgen_runtime.Oj_run.read_until_field_value p lb; + let x = ( + read_engine_of_finding + ) p lb + in + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (Some x : _ option) + | x -> + Atdgen_runtime.Oj_run.invalid_variant_tag p x + ) + | `Double_quote -> ( + match Yojson.Safe.finish_string p lb with + | "None" -> + (None : _ option) + | x -> + Atdgen_runtime.Oj_run.invalid_variant_tag p x + ) + | `Square_bracket -> ( + match Atdgen_runtime.Oj_run.read_string p lb with + | "Some" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_comma p lb; + Yojson.Safe.read_space p lb; + let x = ( + read_engine_of_finding + ) p lb + in + Yojson.Safe.read_space p lb; + Yojson.Safe.read_rbr p lb; + (Some x : _ option) + | x -> + Atdgen_runtime.Oj_run.invalid_variant_tag p x + ) +) +let _engine_of_finding_option_of_string s = + read__engine_of_finding_option (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_cli_match_extra : _ -> cli_match_extra -> _ = ( + fun ob (x : cli_match_extra) -> + Buffer.add_char ob '{'; + let is_first = ref true in + (match x.metavars with None -> () | Some x -> + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"metavars\":"; + ( + write_metavars + ) + ob x; + ); + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"message\":"; + ( + Yojson.Safe.write_string + ) + ob x.message; + (match x.fix with None -> () | Some x -> + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"fix\":"; + ( + Yojson.Safe.write_string + ) + ob x; + ); + (match x.fixed_lines with None -> () | Some x -> + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"fixed_lines\":"; + ( + write__string_list + ) + ob x; + ); + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"metadata\":"; + ( + write_raw_json + ) + ob x.metadata; + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"severity\":"; + ( + write_match_severity + ) + ob x.severity; + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"fingerprint\":"; + ( + Yojson.Safe.write_string ) - ob x.extra; + ob x.fingerprint; + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"lines\":"; + ( + Yojson.Safe.write_string + ) + ob x.lines; + (match x.is_ignored with None -> () | Some x -> + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"is_ignored\":"; + ( + Yojson.Safe.write_bool + ) + ob x; + ); + (match x.sca_info with None -> () | Some x -> + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"sca_info\":"; + ( + write_sca_info + ) + ob x; + ); + (match x.dataflow_trace with None -> () | Some x -> + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"dataflow_trace\":"; + ( + write_match_dataflow_trace + ) + ob x; + ); + (match x.engine_kind with None -> () | Some x -> + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"engine_kind\":"; + ( + write_engine_of_finding + ) + ob x; + ); + (match x.validation_state with None -> () | Some x -> + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"validation_state\":"; + ( + write_validation_state + ) + ob x; + ); + (match x.historical_info with None -> () | Some x -> + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"historical_info\":"; + ( + write_historical_info + ) + ob x; + ); + (match x.extra_extra with None -> () | Some x -> + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"extra_extra\":"; + ( + write_raw_json + ) + ob x; + ); Buffer.add_char ob '}'; ) -let string_of_cli_match ?(len = 1024) x = +let string_of_cli_match_extra ?(len = 1024) x = let ob = Buffer.create len in - write_cli_match ob x; + write_cli_match_extra ob x; Buffer.contents ob -let read_cli_match = ( +let read_cli_match_extra = ( fun p lb -> Yojson.Safe.read_space p lb; Yojson.Safe.read_lcurl p lb; - let field_check_id = ref (None) in - let field_path = ref (None) in - let field_start = ref (None) in - let field_end_ = ref (None) in - let field_extra = ref (None) in + let field_metavars = ref (None) in + let field_message = ref (None) in + let field_fix = ref (None) in + let field_fixed_lines = ref (None) in + let field_metadata = ref (None) in + let field_severity = ref (None) in + let field_fingerprint = ref (None) in + let field_lines = ref (None) in + let field_is_ignored = ref (None) in + let field_sca_info = ref (None) in + let field_dataflow_trace = ref (None) in + let field_engine_kind = ref (None) in + let field_validation_state = ref (None) in + let field_historical_info = ref (None) in + let field_extra_extra = ref (None) in try Yojson.Safe.read_space p lb; Yojson.Safe.read_object_end lb; @@ -19779,34 +19342,138 @@ let read_cli_match = ( invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); match len with | 3 -> ( - if String.unsafe_get s pos = 'e' && String.unsafe_get s (pos+1) = 'n' && String.unsafe_get s (pos+2) = 'd' then ( - 3 + if String.unsafe_get s pos = 'f' && String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = 'x' then ( + 2 ) else ( -1 ) ) - | 4 -> ( - if String.unsafe_get s pos = 'p' && String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'h' then ( + | 5 -> ( + if String.unsafe_get s pos = 'l' && String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = 's' then ( + 7 + ) + else ( + -1 + ) + ) + | 7 -> ( + if String.unsafe_get s pos = 'm' && String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 's' && String.unsafe_get s (pos+3) = 's' && String.unsafe_get s (pos+4) = 'a' && String.unsafe_get s (pos+5) = 'g' && String.unsafe_get s (pos+6) = 'e' then ( 1 ) else ( -1 ) ) - | 5 -> ( + | 8 -> ( match String.unsafe_get s pos with - | 'e' -> ( - if String.unsafe_get s (pos+1) = 'x' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'r' && String.unsafe_get s (pos+4) = 'a' then ( - 4 + | 'm' -> ( + if String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'a' then ( + match String.unsafe_get s (pos+4) with + | 'd' -> ( + if String.unsafe_get s (pos+5) = 'a' && String.unsafe_get s (pos+6) = 't' && String.unsafe_get s (pos+7) = 'a' then ( + 4 + ) + else ( + -1 + ) + ) + | 'v' -> ( + if String.unsafe_get s (pos+5) = 'a' && String.unsafe_get s (pos+6) = 'r' && String.unsafe_get s (pos+7) = 's' then ( + 0 + ) + else ( + -1 + ) + ) + | _ -> ( + -1 + ) ) else ( -1 ) ) | 's' -> ( - if String.unsafe_get s (pos+1) = 't' && String.unsafe_get s (pos+2) = 'a' && String.unsafe_get s (pos+3) = 'r' && String.unsafe_get s (pos+4) = 't' then ( - 2 + match String.unsafe_get s (pos+1) with + | 'c' -> ( + if String.unsafe_get s (pos+2) = 'a' && String.unsafe_get s (pos+3) = '_' && String.unsafe_get s (pos+4) = 'i' && String.unsafe_get s (pos+5) = 'n' && String.unsafe_get s (pos+6) = 'f' && String.unsafe_get s (pos+7) = 'o' then ( + 9 + ) + else ( + -1 + ) + ) + | 'e' -> ( + if String.unsafe_get s (pos+2) = 'v' && String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = 'r' && String.unsafe_get s (pos+5) = 'i' && String.unsafe_get s (pos+6) = 't' && String.unsafe_get s (pos+7) = 'y' then ( + 5 + ) + else ( + -1 + ) + ) + | _ -> ( + -1 + ) + ) + | _ -> ( + -1 + ) + ) + | 10 -> ( + if String.unsafe_get s pos = 'i' && String.unsafe_get s (pos+1) = 's' && String.unsafe_get s (pos+2) = '_' && String.unsafe_get s (pos+3) = 'i' && String.unsafe_get s (pos+4) = 'g' && String.unsafe_get s (pos+5) = 'n' && String.unsafe_get s (pos+6) = 'o' && String.unsafe_get s (pos+7) = 'r' && String.unsafe_get s (pos+8) = 'e' && String.unsafe_get s (pos+9) = 'd' then ( + 8 + ) + else ( + -1 + ) + ) + | 11 -> ( + match String.unsafe_get s pos with + | 'e' -> ( + match String.unsafe_get s (pos+1) with + | 'n' -> ( + if String.unsafe_get s (pos+2) = 'g' && String.unsafe_get s (pos+3) = 'i' && String.unsafe_get s (pos+4) = 'n' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 'k' && String.unsafe_get s (pos+8) = 'i' && String.unsafe_get s (pos+9) = 'n' && String.unsafe_get s (pos+10) = 'd' then ( + 11 + ) + else ( + -1 + ) + ) + | 'x' -> ( + if String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'r' && String.unsafe_get s (pos+4) = 'a' && String.unsafe_get s (pos+5) = '_' && String.unsafe_get s (pos+6) = 'e' && String.unsafe_get s (pos+7) = 'x' && String.unsafe_get s (pos+8) = 't' && String.unsafe_get s (pos+9) = 'r' && String.unsafe_get s (pos+10) = 'a' then ( + 14 + ) + else ( + -1 + ) + ) + | _ -> ( + -1 + ) + ) + | 'f' -> ( + if String.unsafe_get s (pos+1) = 'i' then ( + match String.unsafe_get s (pos+2) with + | 'n' -> ( + if String.unsafe_get s (pos+3) = 'g' && String.unsafe_get s (pos+4) = 'e' && String.unsafe_get s (pos+5) = 'r' && String.unsafe_get s (pos+6) = 'p' && String.unsafe_get s (pos+7) = 'r' && String.unsafe_get s (pos+8) = 'i' && String.unsafe_get s (pos+9) = 'n' && String.unsafe_get s (pos+10) = 't' then ( + 6 + ) + else ( + -1 + ) + ) + | 'x' -> ( + if String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = 'd' && String.unsafe_get s (pos+5) = '_' && String.unsafe_get s (pos+6) = 'l' && String.unsafe_get s (pos+7) = 'i' && String.unsafe_get s (pos+8) = 'n' && String.unsafe_get s (pos+9) = 'e' && String.unsafe_get s (pos+10) = 's' then ( + 3 + ) + else ( + -1 + ) + ) + | _ -> ( + -1 + ) ) else ( -1 @@ -19816,9 +19483,25 @@ let read_cli_match = ( -1 ) ) - | 8 -> ( - if String.unsafe_get s pos = 'c' && String.unsafe_get s (pos+1) = 'h' && String.unsafe_get s (pos+2) = 'e' && String.unsafe_get s (pos+3) = 'c' && String.unsafe_get s (pos+4) = 'k' && String.unsafe_get s (pos+5) = '_' && String.unsafe_get s (pos+6) = 'i' && String.unsafe_get s (pos+7) = 'd' then ( - 0 + | 14 -> ( + if String.unsafe_get s pos = 'd' && String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'a' && String.unsafe_get s (pos+4) = 'f' && String.unsafe_get s (pos+5) = 'l' && String.unsafe_get s (pos+6) = 'o' && String.unsafe_get s (pos+7) = 'w' && String.unsafe_get s (pos+8) = '_' && String.unsafe_get s (pos+9) = 't' && String.unsafe_get s (pos+10) = 'r' && String.unsafe_get s (pos+11) = 'a' && String.unsafe_get s (pos+12) = 'c' && String.unsafe_get s (pos+13) = 'e' then ( + 10 + ) + else ( + -1 + ) + ) + | 15 -> ( + if String.unsafe_get s pos = 'h' && String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = 's' && String.unsafe_get s (pos+3) = 't' && String.unsafe_get s (pos+4) = 'o' && String.unsafe_get s (pos+5) = 'r' && String.unsafe_get s (pos+6) = 'i' && String.unsafe_get s (pos+7) = 'c' && String.unsafe_get s (pos+8) = 'a' && String.unsafe_get s (pos+9) = 'l' && String.unsafe_get s (pos+10) = '_' && String.unsafe_get s (pos+11) = 'i' && String.unsafe_get s (pos+12) = 'n' && String.unsafe_get s (pos+13) = 'f' && String.unsafe_get s (pos+14) = 'o' then ( + 13 + ) + else ( + -1 + ) + ) + | 16 -> ( + if String.unsafe_get s pos = 'v' && String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 'l' && String.unsafe_get s (pos+3) = 'i' && String.unsafe_get s (pos+4) = 'd' && String.unsafe_get s (pos+5) = 'a' && String.unsafe_get s (pos+6) = 't' && String.unsafe_get s (pos+7) = 'i' && String.unsafe_get s (pos+8) = 'o' && String.unsafe_get s (pos+9) = 'n' && String.unsafe_get s (pos+10) = '_' && String.unsafe_get s (pos+11) = 's' && String.unsafe_get s (pos+12) = 't' && String.unsafe_get s (pos+13) = 'a' && String.unsafe_get s (pos+14) = 't' && String.unsafe_get s (pos+15) = 'e' then ( + 12 ) else ( -1 @@ -19833,45 +19516,145 @@ let read_cli_match = ( ( match i with | 0 -> - field_check_id := ( + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_metavars := ( + Some ( + ( + read_metavars + ) p lb + ) + ); + ) + | 1 -> + field_message := ( Some ( ( - read_rule_id + Atdgen_runtime.Oj_run.read_string ) p lb ) ); - | 1 -> - field_path := ( + | 2 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_fix := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_string + ) p lb + ) + ); + ) + | 3 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_fixed_lines := ( + Some ( + ( + read__string_list + ) p lb + ) + ); + ) + | 4 -> + field_metadata := ( Some ( ( - read_fpath + read_raw_json ) p lb ) ); - | 2 -> - field_start := ( + | 5 -> + field_severity := ( Some ( ( - read_position + read_match_severity ) p lb ) ); - | 3 -> - field_end_ := ( + | 6 -> + field_fingerprint := ( Some ( ( - read_position + Atdgen_runtime.Oj_run.read_string ) p lb ) ); - | 4 -> - field_extra := ( + | 7 -> + field_lines := ( Some ( ( - read_cli_match_extra + Atdgen_runtime.Oj_run.read_string ) p lb ) ); + | 8 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_is_ignored := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_bool + ) p lb + ) + ); + ) + | 9 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_sca_info := ( + Some ( + ( + read_sca_info + ) p lb + ) + ); + ) + | 10 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_dataflow_trace := ( + Some ( + ( + read_match_dataflow_trace + ) p lb + ) + ); + ) + | 11 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_engine_kind := ( + Some ( + ( + read_engine_of_finding + ) p lb + ) + ); + ) + | 12 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_validation_state := ( + Some ( + ( + read_validation_state + ) p lb + ) + ); + ) + | 13 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_historical_info := ( + Some ( + ( + read_historical_info + ) p lb + ) + ); + ) + | 14 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_extra_extra := ( + Some ( + ( + read_raw_json + ) p lb + ) + ); + ) | _ -> ( Yojson.Safe.skip_json p lb ) @@ -19886,34 +19669,138 @@ let read_cli_match = ( invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); match len with | 3 -> ( - if String.unsafe_get s pos = 'e' && String.unsafe_get s (pos+1) = 'n' && String.unsafe_get s (pos+2) = 'd' then ( - 3 + if String.unsafe_get s pos = 'f' && String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = 'x' then ( + 2 ) else ( -1 ) ) - | 4 -> ( - if String.unsafe_get s pos = 'p' && String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'h' then ( + | 5 -> ( + if String.unsafe_get s pos = 'l' && String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = 's' then ( + 7 + ) + else ( + -1 + ) + ) + | 7 -> ( + if String.unsafe_get s pos = 'm' && String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 's' && String.unsafe_get s (pos+3) = 's' && String.unsafe_get s (pos+4) = 'a' && String.unsafe_get s (pos+5) = 'g' && String.unsafe_get s (pos+6) = 'e' then ( 1 ) else ( -1 ) ) - | 5 -> ( + | 8 -> ( match String.unsafe_get s pos with - | 'e' -> ( - if String.unsafe_get s (pos+1) = 'x' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'r' && String.unsafe_get s (pos+4) = 'a' then ( - 4 + | 'm' -> ( + if String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'a' then ( + match String.unsafe_get s (pos+4) with + | 'd' -> ( + if String.unsafe_get s (pos+5) = 'a' && String.unsafe_get s (pos+6) = 't' && String.unsafe_get s (pos+7) = 'a' then ( + 4 + ) + else ( + -1 + ) + ) + | 'v' -> ( + if String.unsafe_get s (pos+5) = 'a' && String.unsafe_get s (pos+6) = 'r' && String.unsafe_get s (pos+7) = 's' then ( + 0 + ) + else ( + -1 + ) + ) + | _ -> ( + -1 + ) ) else ( -1 ) ) | 's' -> ( - if String.unsafe_get s (pos+1) = 't' && String.unsafe_get s (pos+2) = 'a' && String.unsafe_get s (pos+3) = 'r' && String.unsafe_get s (pos+4) = 't' then ( - 2 + match String.unsafe_get s (pos+1) with + | 'c' -> ( + if String.unsafe_get s (pos+2) = 'a' && String.unsafe_get s (pos+3) = '_' && String.unsafe_get s (pos+4) = 'i' && String.unsafe_get s (pos+5) = 'n' && String.unsafe_get s (pos+6) = 'f' && String.unsafe_get s (pos+7) = 'o' then ( + 9 + ) + else ( + -1 + ) + ) + | 'e' -> ( + if String.unsafe_get s (pos+2) = 'v' && String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = 'r' && String.unsafe_get s (pos+5) = 'i' && String.unsafe_get s (pos+6) = 't' && String.unsafe_get s (pos+7) = 'y' then ( + 5 + ) + else ( + -1 + ) + ) + | _ -> ( + -1 + ) + ) + | _ -> ( + -1 + ) + ) + | 10 -> ( + if String.unsafe_get s pos = 'i' && String.unsafe_get s (pos+1) = 's' && String.unsafe_get s (pos+2) = '_' && String.unsafe_get s (pos+3) = 'i' && String.unsafe_get s (pos+4) = 'g' && String.unsafe_get s (pos+5) = 'n' && String.unsafe_get s (pos+6) = 'o' && String.unsafe_get s (pos+7) = 'r' && String.unsafe_get s (pos+8) = 'e' && String.unsafe_get s (pos+9) = 'd' then ( + 8 + ) + else ( + -1 + ) + ) + | 11 -> ( + match String.unsafe_get s pos with + | 'e' -> ( + match String.unsafe_get s (pos+1) with + | 'n' -> ( + if String.unsafe_get s (pos+2) = 'g' && String.unsafe_get s (pos+3) = 'i' && String.unsafe_get s (pos+4) = 'n' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 'k' && String.unsafe_get s (pos+8) = 'i' && String.unsafe_get s (pos+9) = 'n' && String.unsafe_get s (pos+10) = 'd' then ( + 11 + ) + else ( + -1 + ) + ) + | 'x' -> ( + if String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'r' && String.unsafe_get s (pos+4) = 'a' && String.unsafe_get s (pos+5) = '_' && String.unsafe_get s (pos+6) = 'e' && String.unsafe_get s (pos+7) = 'x' && String.unsafe_get s (pos+8) = 't' && String.unsafe_get s (pos+9) = 'r' && String.unsafe_get s (pos+10) = 'a' then ( + 14 + ) + else ( + -1 + ) + ) + | _ -> ( + -1 + ) + ) + | 'f' -> ( + if String.unsafe_get s (pos+1) = 'i' then ( + match String.unsafe_get s (pos+2) with + | 'n' -> ( + if String.unsafe_get s (pos+3) = 'g' && String.unsafe_get s (pos+4) = 'e' && String.unsafe_get s (pos+5) = 'r' && String.unsafe_get s (pos+6) = 'p' && String.unsafe_get s (pos+7) = 'r' && String.unsafe_get s (pos+8) = 'i' && String.unsafe_get s (pos+9) = 'n' && String.unsafe_get s (pos+10) = 't' then ( + 6 + ) + else ( + -1 + ) + ) + | 'x' -> ( + if String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = 'd' && String.unsafe_get s (pos+5) = '_' && String.unsafe_get s (pos+6) = 'l' && String.unsafe_get s (pos+7) = 'i' && String.unsafe_get s (pos+8) = 'n' && String.unsafe_get s (pos+9) = 'e' && String.unsafe_get s (pos+10) = 's' then ( + 3 + ) + else ( + -1 + ) + ) + | _ -> ( + -1 + ) ) else ( -1 @@ -19923,9 +19810,25 @@ let read_cli_match = ( -1 ) ) - | 8 -> ( - if String.unsafe_get s pos = 'c' && String.unsafe_get s (pos+1) = 'h' && String.unsafe_get s (pos+2) = 'e' && String.unsafe_get s (pos+3) = 'c' && String.unsafe_get s (pos+4) = 'k' && String.unsafe_get s (pos+5) = '_' && String.unsafe_get s (pos+6) = 'i' && String.unsafe_get s (pos+7) = 'd' then ( - 0 + | 14 -> ( + if String.unsafe_get s pos = 'd' && String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'a' && String.unsafe_get s (pos+4) = 'f' && String.unsafe_get s (pos+5) = 'l' && String.unsafe_get s (pos+6) = 'o' && String.unsafe_get s (pos+7) = 'w' && String.unsafe_get s (pos+8) = '_' && String.unsafe_get s (pos+9) = 't' && String.unsafe_get s (pos+10) = 'r' && String.unsafe_get s (pos+11) = 'a' && String.unsafe_get s (pos+12) = 'c' && String.unsafe_get s (pos+13) = 'e' then ( + 10 + ) + else ( + -1 + ) + ) + | 15 -> ( + if String.unsafe_get s pos = 'h' && String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = 's' && String.unsafe_get s (pos+3) = 't' && String.unsafe_get s (pos+4) = 'o' && String.unsafe_get s (pos+5) = 'r' && String.unsafe_get s (pos+6) = 'i' && String.unsafe_get s (pos+7) = 'c' && String.unsafe_get s (pos+8) = 'a' && String.unsafe_get s (pos+9) = 'l' && String.unsafe_get s (pos+10) = '_' && String.unsafe_get s (pos+11) = 'i' && String.unsafe_get s (pos+12) = 'n' && String.unsafe_get s (pos+13) = 'f' && String.unsafe_get s (pos+14) = 'o' then ( + 13 + ) + else ( + -1 + ) + ) + | 16 -> ( + if String.unsafe_get s pos = 'v' && String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 'l' && String.unsafe_get s (pos+3) = 'i' && String.unsafe_get s (pos+4) = 'd' && String.unsafe_get s (pos+5) = 'a' && String.unsafe_get s (pos+6) = 't' && String.unsafe_get s (pos+7) = 'i' && String.unsafe_get s (pos+8) = 'o' && String.unsafe_get s (pos+9) = 'n' && String.unsafe_get s (pos+10) = '_' && String.unsafe_get s (pos+11) = 's' && String.unsafe_get s (pos+12) = 't' && String.unsafe_get s (pos+13) = 'a' && String.unsafe_get s (pos+14) = 't' && String.unsafe_get s (pos+15) = 'e' then ( + 12 ) else ( -1 @@ -19940,45 +19843,145 @@ let read_cli_match = ( ( match i with | 0 -> - field_check_id := ( + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_metavars := ( + Some ( + ( + read_metavars + ) p lb + ) + ); + ) + | 1 -> + field_message := ( Some ( ( - read_rule_id + Atdgen_runtime.Oj_run.read_string ) p lb ) ); - | 1 -> - field_path := ( + | 2 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_fix := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_string + ) p lb + ) + ); + ) + | 3 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_fixed_lines := ( + Some ( + ( + read__string_list + ) p lb + ) + ); + ) + | 4 -> + field_metadata := ( Some ( ( - read_fpath + read_raw_json ) p lb ) ); - | 2 -> - field_start := ( + | 5 -> + field_severity := ( Some ( ( - read_position + read_match_severity ) p lb ) ); - | 3 -> - field_end_ := ( + | 6 -> + field_fingerprint := ( Some ( ( - read_position + Atdgen_runtime.Oj_run.read_string ) p lb ) ); - | 4 -> - field_extra := ( + | 7 -> + field_lines := ( Some ( ( - read_cli_match_extra + Atdgen_runtime.Oj_run.read_string ) p lb ) ); + | 8 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_is_ignored := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_bool + ) p lb + ) + ); + ) + | 9 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_sca_info := ( + Some ( + ( + read_sca_info + ) p lb + ) + ); + ) + | 10 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_dataflow_trace := ( + Some ( + ( + read_match_dataflow_trace + ) p lb + ) + ); + ) + | 11 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_engine_kind := ( + Some ( + ( + read_engine_of_finding + ) p lb + ) + ); + ) + | 12 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_validation_state := ( + Some ( + ( + read_validation_state + ) p lb + ) + ); + ) + | 13 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_historical_info := ( + Some ( + ( + read_historical_info + ) p lb + ) + ); + ) + | 14 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_extra_extra := ( + Some ( + ( + read_raw_json + ) p lb + ) + ); + ) | _ -> ( Yojson.Safe.skip_json p lb ) @@ -19988,218 +19991,91 @@ let read_cli_match = ( with Yojson.End_of_object -> ( ( { - check_id = (match !field_check_id with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "check_id"); - path = (match !field_path with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "path"); - start = (match !field_start with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "start"); - end_ = (match !field_end_ with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "end_"); - extra = (match !field_extra with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "extra"); + metavars = !field_metavars; + message = (match !field_message with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "message"); + fix = !field_fix; + fixed_lines = !field_fixed_lines; + metadata = (match !field_metadata with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "metadata"); + severity = (match !field_severity with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "severity"); + fingerprint = (match !field_fingerprint with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "fingerprint"); + lines = (match !field_lines with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "lines"); + is_ignored = !field_is_ignored; + sca_info = !field_sca_info; + dataflow_trace = !field_dataflow_trace; + engine_kind = !field_engine_kind; + validation_state = !field_validation_state; + historical_info = !field_historical_info; + extra_extra = !field_extra_extra; } - : cli_match) + : cli_match_extra) ) -) -let cli_match_of_string s = - read_cli_match (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__error_span_list = ( - Atdgen_runtime.Oj_run.write_list ( - write_error_span - ) -) -let string_of__error_span_list ?(len = 1024) x = - let ob = Buffer.create len in - write__error_span_list ob x; - Buffer.contents ob -let read__error_span_list = ( - Atdgen_runtime.Oj_run.read_list ( - read_error_span - ) -) -let _error_span_list_of_string s = - read__error_span_list (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__error_span_list_option = ( - Atdgen_runtime.Oj_run.write_std_option ( - write__error_span_list - ) -) -let string_of__error_span_list_option ?(len = 1024) x = - let ob = Buffer.create len in - write__error_span_list_option ob x; - Buffer.contents ob -let read__error_span_list_option = ( - fun p lb -> - Yojson.Safe.read_space p lb; - match Yojson.Safe.start_any_variant p lb with - | `Edgy_bracket -> ( - match Yojson.Safe.read_ident p lb with - | "None" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (None : _ option) - | "Some" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read__error_span_list - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (Some x : _ option) - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Double_quote -> ( - match Yojson.Safe.finish_string p lb with - | "None" -> - (None : _ option) - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Square_bracket -> ( - match Atdgen_runtime.Oj_run.read_string p lb with - | "Some" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read__error_span_list - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - (Some x : _ option) - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) -) -let _error_span_list_option_of_string s = - read__error_span_list_option (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_cli_error : _ -> cli_error -> _ = ( - fun ob (x : cli_error) -> +) +let cli_match_extra_of_string s = + read_cli_match_extra (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_cli_match : _ -> cli_match -> _ = ( + fun ob (x : cli_match) -> Buffer.add_char ob '{'; let is_first = ref true in if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"code\":"; + Buffer.add_string ob "\"check_id\":"; ( - Yojson.Safe.write_int + write_rule_id ) - ob x.code; + ob x.check_id; if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"level\":"; + Buffer.add_string ob "\"path\":"; ( - write_error_severity + write_fpath ) - ob x.level; + ob x.path; if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"type\":"; + Buffer.add_string ob "\"start\":"; ( - write_error_type + write_position ) - ob x.type_; - (match x.rule_id with None -> () | Some x -> - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"rule_id\":"; - ( - write_rule_id - ) - ob x; - ); - (match x.message with None -> () | Some x -> - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"message\":"; - ( - Yojson.Safe.write_string - ) - ob x; - ); - (match x.path with None -> () | Some x -> - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"path\":"; - ( - write_fpath - ) - ob x; - ); - (match x.long_msg with None -> () | Some x -> - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"long_msg\":"; - ( - Yojson.Safe.write_string - ) - ob x; - ); - (match x.short_msg with None -> () | Some x -> - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"short_msg\":"; - ( - Yojson.Safe.write_string - ) - ob x; - ); - (match x.spans with None -> () | Some x -> - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"spans\":"; - ( - write__error_span_list - ) - ob x; - ); - (match x.help with None -> () | Some x -> - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"help\":"; - ( - Yojson.Safe.write_string - ) - ob x; - ); + ob x.start; + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"end\":"; + ( + write_position + ) + ob x.end_; + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"extra\":"; + ( + write_cli_match_extra + ) + ob x.extra; Buffer.add_char ob '}'; ) -let string_of_cli_error ?(len = 1024) x = +let string_of_cli_match ?(len = 1024) x = let ob = Buffer.create len in - write_cli_error ob x; + write_cli_match ob x; Buffer.contents ob -let read_cli_error = ( +let read_cli_match = ( fun p lb -> Yojson.Safe.read_space p lb; Yojson.Safe.read_lcurl p lb; - let field_code = ref (None) in - let field_level = ref (None) in - let field_type_ = ref (None) in - let field_rule_id = ref (None) in - let field_message = ref (None) in + let field_check_id = ref (None) in let field_path = ref (None) in - let field_long_msg = ref (None) in - let field_short_msg = ref (None) in - let field_spans = ref (None) in - let field_help = ref (None) in + let field_start = ref (None) in + let field_end_ = ref (None) in + let field_extra = ref (None) in try Yojson.Safe.read_space p lb; Yojson.Safe.read_object_end lb; @@ -20209,79 +20085,35 @@ let read_cli_error = ( if pos < 0 || len < 0 || pos + len > String.length s then invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); match len with + | 3 -> ( + if String.unsafe_get s pos = 'e' && String.unsafe_get s (pos+1) = 'n' && String.unsafe_get s (pos+2) = 'd' then ( + 3 + ) + else ( + -1 + ) + ) | 4 -> ( - match String.unsafe_get s pos with - | 'c' -> ( - if String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'd' && String.unsafe_get s (pos+3) = 'e' then ( - 0 - ) - else ( - -1 - ) - ) - | 'h' -> ( - if String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'l' && String.unsafe_get s (pos+3) = 'p' then ( - 9 - ) - else ( - -1 - ) - ) - | 'p' -> ( - if String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'h' then ( - 5 - ) - else ( - -1 - ) - ) - | 't' -> ( - if String.unsafe_get s (pos+1) = 'y' && String.unsafe_get s (pos+2) = 'p' && String.unsafe_get s (pos+3) = 'e' then ( - 2 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) + if String.unsafe_get s pos = 'p' && String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'h' then ( + 1 + ) + else ( + -1 + ) ) | 5 -> ( match String.unsafe_get s pos with - | 'l' -> ( - if String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'v' && String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = 'l' then ( - 1 - ) - else ( - -1 - ) - ) - | 's' -> ( - if String.unsafe_get s (pos+1) = 'p' && String.unsafe_get s (pos+2) = 'a' && String.unsafe_get s (pos+3) = 'n' && String.unsafe_get s (pos+4) = 's' then ( - 8 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - ) - | 7 -> ( - match String.unsafe_get s pos with - | 'm' -> ( - if String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 's' && String.unsafe_get s (pos+3) = 's' && String.unsafe_get s (pos+4) = 'a' && String.unsafe_get s (pos+5) = 'g' && String.unsafe_get s (pos+6) = 'e' then ( + | 'e' -> ( + if String.unsafe_get s (pos+1) = 'x' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'r' && String.unsafe_get s (pos+4) = 'a' then ( 4 ) else ( -1 ) ) - | 'r' -> ( - if String.unsafe_get s (pos+1) = 'u' && String.unsafe_get s (pos+2) = 'l' && String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = '_' && String.unsafe_get s (pos+5) = 'i' && String.unsafe_get s (pos+6) = 'd' then ( - 3 + | 's' -> ( + if String.unsafe_get s (pos+1) = 't' && String.unsafe_get s (pos+2) = 'a' && String.unsafe_get s (pos+3) = 'r' && String.unsafe_get s (pos+4) = 't' then ( + 2 ) else ( -1 @@ -20292,16 +20124,8 @@ let read_cli_error = ( ) ) | 8 -> ( - if String.unsafe_get s pos = 'l' && String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = 'g' && String.unsafe_get s (pos+4) = '_' && String.unsafe_get s (pos+5) = 'm' && String.unsafe_get s (pos+6) = 's' && String.unsafe_get s (pos+7) = 'g' then ( - 6 - ) - else ( - -1 - ) - ) - | 9 -> ( - if String.unsafe_get s pos = 's' && String.unsafe_get s (pos+1) = 'h' && String.unsafe_get s (pos+2) = 'o' && String.unsafe_get s (pos+3) = 'r' && String.unsafe_get s (pos+4) = 't' && String.unsafe_get s (pos+5) = '_' && String.unsafe_get s (pos+6) = 'm' && String.unsafe_get s (pos+7) = 's' && String.unsafe_get s (pos+8) = 'g' then ( - 7 + if String.unsafe_get s pos = 'c' && String.unsafe_get s (pos+1) = 'h' && String.unsafe_get s (pos+2) = 'e' && String.unsafe_get s (pos+3) = 'c' && String.unsafe_get s (pos+4) = 'k' && String.unsafe_get s (pos+5) = '_' && String.unsafe_get s (pos+6) = 'i' && String.unsafe_get s (pos+7) = 'd' then ( + 0 ) else ( -1 @@ -20316,99 +20140,45 @@ let read_cli_error = ( ( match i with | 0 -> - field_code := ( + field_check_id := ( Some ( ( - Atdgen_runtime.Oj_run.read_int + read_rule_id ) p lb ) ); | 1 -> - field_level := ( + field_path := ( Some ( ( - read_error_severity + read_fpath ) p lb ) ); | 2 -> - field_type_ := ( + field_start := ( + Some ( + ( + read_position + ) p lb + ) + ); + | 3 -> + field_end_ := ( + Some ( + ( + read_position + ) p lb + ) + ); + | 4 -> + field_extra := ( Some ( ( - read_error_type + read_cli_match_extra ) p lb ) ); - | 3 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_rule_id := ( - Some ( - ( - read_rule_id - ) p lb - ) - ); - ) - | 4 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_message := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_string - ) p lb - ) - ); - ) - | 5 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_path := ( - Some ( - ( - read_fpath - ) p lb - ) - ); - ) - | 6 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_long_msg := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_string - ) p lb - ) - ); - ) - | 7 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_short_msg := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_string - ) p lb - ) - ); - ) - | 8 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_spans := ( - Some ( - ( - read__error_span_list - ) p lb - ) - ); - ) - | 9 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_help := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_string - ) p lb - ) - ); - ) | _ -> ( Yojson.Safe.skip_json p lb ) @@ -20422,79 +20192,35 @@ let read_cli_error = ( if pos < 0 || len < 0 || pos + len > String.length s then invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); match len with + | 3 -> ( + if String.unsafe_get s pos = 'e' && String.unsafe_get s (pos+1) = 'n' && String.unsafe_get s (pos+2) = 'd' then ( + 3 + ) + else ( + -1 + ) + ) | 4 -> ( - match String.unsafe_get s pos with - | 'c' -> ( - if String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'd' && String.unsafe_get s (pos+3) = 'e' then ( - 0 - ) - else ( - -1 - ) - ) - | 'h' -> ( - if String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'l' && String.unsafe_get s (pos+3) = 'p' then ( - 9 - ) - else ( - -1 - ) - ) - | 'p' -> ( - if String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'h' then ( - 5 - ) - else ( - -1 - ) - ) - | 't' -> ( - if String.unsafe_get s (pos+1) = 'y' && String.unsafe_get s (pos+2) = 'p' && String.unsafe_get s (pos+3) = 'e' then ( - 2 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) + if String.unsafe_get s pos = 'p' && String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'h' then ( + 1 + ) + else ( + -1 + ) ) | 5 -> ( match String.unsafe_get s pos with - | 'l' -> ( - if String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'v' && String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = 'l' then ( - 1 - ) - else ( - -1 - ) - ) - | 's' -> ( - if String.unsafe_get s (pos+1) = 'p' && String.unsafe_get s (pos+2) = 'a' && String.unsafe_get s (pos+3) = 'n' && String.unsafe_get s (pos+4) = 's' then ( - 8 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - ) - | 7 -> ( - match String.unsafe_get s pos with - | 'm' -> ( - if String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 's' && String.unsafe_get s (pos+3) = 's' && String.unsafe_get s (pos+4) = 'a' && String.unsafe_get s (pos+5) = 'g' && String.unsafe_get s (pos+6) = 'e' then ( + | 'e' -> ( + if String.unsafe_get s (pos+1) = 'x' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'r' && String.unsafe_get s (pos+4) = 'a' then ( 4 ) else ( -1 ) ) - | 'r' -> ( - if String.unsafe_get s (pos+1) = 'u' && String.unsafe_get s (pos+2) = 'l' && String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = '_' && String.unsafe_get s (pos+5) = 'i' && String.unsafe_get s (pos+6) = 'd' then ( - 3 + | 's' -> ( + if String.unsafe_get s (pos+1) = 't' && String.unsafe_get s (pos+2) = 'a' && String.unsafe_get s (pos+3) = 'r' && String.unsafe_get s (pos+4) = 't' then ( + 2 ) else ( -1 @@ -20505,16 +20231,8 @@ let read_cli_error = ( ) ) | 8 -> ( - if String.unsafe_get s pos = 'l' && String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = 'g' && String.unsafe_get s (pos+4) = '_' && String.unsafe_get s (pos+5) = 'm' && String.unsafe_get s (pos+6) = 's' && String.unsafe_get s (pos+7) = 'g' then ( - 6 - ) - else ( - -1 - ) - ) - | 9 -> ( - if String.unsafe_get s pos = 's' && String.unsafe_get s (pos+1) = 'h' && String.unsafe_get s (pos+2) = 'o' && String.unsafe_get s (pos+3) = 'r' && String.unsafe_get s (pos+4) = 't' && String.unsafe_get s (pos+5) = '_' && String.unsafe_get s (pos+6) = 'm' && String.unsafe_get s (pos+7) = 's' && String.unsafe_get s (pos+8) = 'g' then ( - 7 + if String.unsafe_get s pos = 'c' && String.unsafe_get s (pos+1) = 'h' && String.unsafe_get s (pos+2) = 'e' && String.unsafe_get s (pos+3) = 'c' && String.unsafe_get s (pos+4) = 'k' && String.unsafe_get s (pos+5) = '_' && String.unsafe_get s (pos+6) = 'i' && String.unsafe_get s (pos+7) = 'd' then ( + 0 ) else ( -1 @@ -20529,99 +20247,45 @@ let read_cli_error = ( ( match i with | 0 -> - field_code := ( + field_check_id := ( Some ( ( - Atdgen_runtime.Oj_run.read_int + read_rule_id ) p lb ) ); | 1 -> - field_level := ( - Some ( - ( - read_error_severity - ) p lb - ) - ); - | 2 -> - field_type_ := ( + field_path := ( Some ( - ( - read_error_type - ) p lb - ) - ); - | 3 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_rule_id := ( - Some ( - ( - read_rule_id - ) p lb - ) - ); - ) - | 4 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_message := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_string - ) p lb - ) - ); - ) - | 5 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_path := ( - Some ( - ( - read_fpath - ) p lb - ) - ); - ) - | 6 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_long_msg := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_string - ) p lb - ) - ); - ) - | 7 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_short_msg := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_string - ) p lb - ) - ); - ) - | 8 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_spans := ( - Some ( - ( - read__error_span_list - ) p lb - ) - ); - ) - | 9 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_help := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_string - ) p lb - ) - ); - ) + ( + read_fpath + ) p lb + ) + ); + | 2 -> + field_start := ( + Some ( + ( + read_position + ) p lb + ) + ); + | 3 -> + field_end_ := ( + Some ( + ( + read_position + ) p lb + ) + ); + | 4 -> + field_extra := ( + Some ( + ( + read_cli_match_extra + ) p lb + ) + ); | _ -> ( Yojson.Safe.skip_json p lb ) @@ -20631,130 +20295,218 @@ let read_cli_error = ( with Yojson.End_of_object -> ( ( { - code = (match !field_code with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "code"); - level = (match !field_level with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "level"); - type_ = (match !field_type_ with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "type_"); - rule_id = !field_rule_id; - message = !field_message; - path = !field_path; - long_msg = !field_long_msg; - short_msg = !field_short_msg; - spans = !field_spans; - help = !field_help; + check_id = (match !field_check_id with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "check_id"); + path = (match !field_path with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "path"); + start = (match !field_start with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "start"); + end_ = (match !field_end_ with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "end_"); + extra = (match !field_extra with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "extra"); } - : cli_error) + : cli_match) ) ) -let cli_error_of_string s = - read_cli_error (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__cli_match_list = ( +let cli_match_of_string s = + read_cli_match (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write__error_span_list = ( Atdgen_runtime.Oj_run.write_list ( - write_cli_match + write_error_span ) ) -let string_of__cli_match_list ?(len = 1024) x = +let string_of__error_span_list ?(len = 1024) x = let ob = Buffer.create len in - write__cli_match_list ob x; + write__error_span_list ob x; Buffer.contents ob -let read__cli_match_list = ( +let read__error_span_list = ( Atdgen_runtime.Oj_run.read_list ( - read_cli_match + read_error_span ) ) -let _cli_match_list_of_string s = - read__cli_match_list (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__cli_error_list = ( - Atdgen_runtime.Oj_run.write_list ( - write_cli_error +let _error_span_list_of_string s = + read__error_span_list (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write__error_span_list_option = ( + Atdgen_runtime.Oj_run.write_std_option ( + write__error_span_list ) ) -let string_of__cli_error_list ?(len = 1024) x = +let string_of__error_span_list_option ?(len = 1024) x = let ob = Buffer.create len in - write__cli_error_list ob x; + write__error_span_list_option ob x; Buffer.contents ob -let read__cli_error_list = ( - Atdgen_runtime.Oj_run.read_list ( - read_cli_error - ) +let read__error_span_list_option = ( + fun p lb -> + Yojson.Safe.read_space p lb; + match Yojson.Safe.start_any_variant p lb with + | `Edgy_bracket -> ( + match Yojson.Safe.read_ident p lb with + | "None" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (None : _ option) + | "Some" -> + Atdgen_runtime.Oj_run.read_until_field_value p lb; + let x = ( + read__error_span_list + ) p lb + in + Yojson.Safe.read_space p lb; + Yojson.Safe.read_gt p lb; + (Some x : _ option) + | x -> + Atdgen_runtime.Oj_run.invalid_variant_tag p x + ) + | `Double_quote -> ( + match Yojson.Safe.finish_string p lb with + | "None" -> + (None : _ option) + | x -> + Atdgen_runtime.Oj_run.invalid_variant_tag p x + ) + | `Square_bracket -> ( + match Atdgen_runtime.Oj_run.read_string p lb with + | "Some" -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_comma p lb; + Yojson.Safe.read_space p lb; + let x = ( + read__error_span_list + ) p lb + in + Yojson.Safe.read_space p lb; + Yojson.Safe.read_rbr p lb; + (Some x : _ option) + | x -> + Atdgen_runtime.Oj_run.invalid_variant_tag p x + ) ) -let _cli_error_list_of_string s = - read__cli_error_list (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_sarif_format_params : _ -> sarif_format_params -> _ = ( - fun ob (x : sarif_format_params) -> +let _error_span_list_option_of_string s = + read__error_span_list_option (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_cli_error : _ -> cli_error -> _ = ( + fun ob (x : cli_error) -> Buffer.add_char ob '{'; let is_first = ref true in if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"hide_nudge\":"; - ( - Yojson.Safe.write_bool - ) - ob x.hide_nudge; - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"engine_label\":"; - ( - Yojson.Safe.write_string - ) - ob x.engine_label; - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"rules\":"; + Buffer.add_string ob "\"code\":"; ( - write_fpath + Yojson.Safe.write_int ) - ob x.rules; + ob x.code; if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"cli_matches\":"; + Buffer.add_string ob "\"level\":"; ( - write__cli_match_list + write_error_severity ) - ob x.cli_matches; + ob x.level; if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"cli_errors\":"; + Buffer.add_string ob "\"type\":"; ( - write__cli_error_list + write_error_type ) - ob x.cli_errors; - (match x.show_dataflow_traces with None -> () | Some x -> + ob x.type_; + (match x.rule_id with None -> () | Some x -> if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"show_dataflow_traces\":"; + Buffer.add_string ob "\"rule_id\":"; ( - Yojson.Safe.write_bool + write_rule_id + ) + ob x; + ); + (match x.message with None -> () | Some x -> + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"message\":"; + ( + Yojson.Safe.write_string + ) + ob x; + ); + (match x.path with None -> () | Some x -> + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"path\":"; + ( + write_fpath + ) + ob x; + ); + (match x.long_msg with None -> () | Some x -> + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"long_msg\":"; + ( + Yojson.Safe.write_string + ) + ob x; + ); + (match x.short_msg with None -> () | Some x -> + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"short_msg\":"; + ( + Yojson.Safe.write_string + ) + ob x; + ); + (match x.spans with None -> () | Some x -> + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"spans\":"; + ( + write__error_span_list + ) + ob x; + ); + (match x.help with None -> () | Some x -> + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"help\":"; + ( + Yojson.Safe.write_string ) ob x; ); Buffer.add_char ob '}'; ) -let string_of_sarif_format_params ?(len = 1024) x = +let string_of_cli_error ?(len = 1024) x = let ob = Buffer.create len in - write_sarif_format_params ob x; - Buffer.contents ob -let read_sarif_format_params = ( - fun p lb -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_lcurl p lb; - let field_hide_nudge = ref (None) in - let field_engine_label = ref (None) in - let field_rules = ref (None) in - let field_cli_matches = ref (None) in - let field_cli_errors = ref (None) in - let field_show_dataflow_traces = ref (None) in + write_cli_error ob x; + Buffer.contents ob +let read_cli_error = ( + fun p lb -> + Yojson.Safe.read_space p lb; + Yojson.Safe.read_lcurl p lb; + let field_code = ref (None) in + let field_level = ref (None) in + let field_type_ = ref (None) in + let field_rule_id = ref (None) in + let field_message = ref (None) in + let field_path = ref (None) in + let field_long_msg = ref (None) in + let field_short_msg = ref (None) in + let field_spans = ref (None) in + let field_help = ref (None) in try Yojson.Safe.read_space p lb; Yojson.Safe.read_object_end lb; @@ -20764,27 +20516,35 @@ let read_sarif_format_params = ( if pos < 0 || len < 0 || pos + len > String.length s then invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); match len with - | 5 -> ( - if String.unsafe_get s pos = 'r' && String.unsafe_get s (pos+1) = 'u' && String.unsafe_get s (pos+2) = 'l' && String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = 's' then ( - 2 - ) - else ( - -1 - ) - ) - | 10 -> ( + | 4 -> ( match String.unsafe_get s pos with | 'c' -> ( - if String.unsafe_get s (pos+1) = 'l' && String.unsafe_get s (pos+2) = 'i' && String.unsafe_get s (pos+3) = '_' && String.unsafe_get s (pos+4) = 'e' && String.unsafe_get s (pos+5) = 'r' && String.unsafe_get s (pos+6) = 'r' && String.unsafe_get s (pos+7) = 'o' && String.unsafe_get s (pos+8) = 'r' && String.unsafe_get s (pos+9) = 's' then ( - 4 + if String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'd' && String.unsafe_get s (pos+3) = 'e' then ( + 0 ) else ( -1 ) ) | 'h' -> ( - if String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = 'd' && String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = '_' && String.unsafe_get s (pos+5) = 'n' && String.unsafe_get s (pos+6) = 'u' && String.unsafe_get s (pos+7) = 'd' && String.unsafe_get s (pos+8) = 'g' && String.unsafe_get s (pos+9) = 'e' then ( - 0 + if String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'l' && String.unsafe_get s (pos+3) = 'p' then ( + 9 + ) + else ( + -1 + ) + ) + | 'p' -> ( + if String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'h' then ( + 5 + ) + else ( + -1 + ) + ) + | 't' -> ( + if String.unsafe_get s (pos+1) = 'y' && String.unsafe_get s (pos+2) = 'p' && String.unsafe_get s (pos+3) = 'e' then ( + 2 ) else ( -1 @@ -20794,25 +20554,61 @@ let read_sarif_format_params = ( -1 ) ) - | 11 -> ( - if String.unsafe_get s pos = 'c' && String.unsafe_get s (pos+1) = 'l' && String.unsafe_get s (pos+2) = 'i' && String.unsafe_get s (pos+3) = '_' && String.unsafe_get s (pos+4) = 'm' && String.unsafe_get s (pos+5) = 'a' && String.unsafe_get s (pos+6) = 't' && String.unsafe_get s (pos+7) = 'c' && String.unsafe_get s (pos+8) = 'h' && String.unsafe_get s (pos+9) = 'e' && String.unsafe_get s (pos+10) = 's' then ( - 3 - ) - else ( - -1 - ) + | 5 -> ( + match String.unsafe_get s pos with + | 'l' -> ( + if String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'v' && String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = 'l' then ( + 1 + ) + else ( + -1 + ) + ) + | 's' -> ( + if String.unsafe_get s (pos+1) = 'p' && String.unsafe_get s (pos+2) = 'a' && String.unsafe_get s (pos+3) = 'n' && String.unsafe_get s (pos+4) = 's' then ( + 8 + ) + else ( + -1 + ) + ) + | _ -> ( + -1 + ) ) - | 12 -> ( - if String.unsafe_get s pos = 'e' && String.unsafe_get s (pos+1) = 'n' && String.unsafe_get s (pos+2) = 'g' && String.unsafe_get s (pos+3) = 'i' && String.unsafe_get s (pos+4) = 'n' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 'l' && String.unsafe_get s (pos+8) = 'a' && String.unsafe_get s (pos+9) = 'b' && String.unsafe_get s (pos+10) = 'e' && String.unsafe_get s (pos+11) = 'l' then ( - 1 + | 7 -> ( + match String.unsafe_get s pos with + | 'm' -> ( + if String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 's' && String.unsafe_get s (pos+3) = 's' && String.unsafe_get s (pos+4) = 'a' && String.unsafe_get s (pos+5) = 'g' && String.unsafe_get s (pos+6) = 'e' then ( + 4 + ) + else ( + -1 + ) + ) + | 'r' -> ( + if String.unsafe_get s (pos+1) = 'u' && String.unsafe_get s (pos+2) = 'l' && String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = '_' && String.unsafe_get s (pos+5) = 'i' && String.unsafe_get s (pos+6) = 'd' then ( + 3 + ) + else ( + -1 + ) + ) + | _ -> ( + -1 + ) + ) + | 8 -> ( + if String.unsafe_get s pos = 'l' && String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = 'g' && String.unsafe_get s (pos+4) = '_' && String.unsafe_get s (pos+5) = 'm' && String.unsafe_get s (pos+6) = 's' && String.unsafe_get s (pos+7) = 'g' then ( + 6 ) else ( -1 ) ) - | 20 -> ( - if String.unsafe_get s pos = 's' && String.unsafe_get s (pos+1) = 'h' && String.unsafe_get s (pos+2) = 'o' && String.unsafe_get s (pos+3) = 'w' && String.unsafe_get s (pos+4) = '_' && String.unsafe_get s (pos+5) = 'd' && String.unsafe_get s (pos+6) = 'a' && String.unsafe_get s (pos+7) = 't' && String.unsafe_get s (pos+8) = 'a' && String.unsafe_get s (pos+9) = 'f' && String.unsafe_get s (pos+10) = 'l' && String.unsafe_get s (pos+11) = 'o' && String.unsafe_get s (pos+12) = 'w' && String.unsafe_get s (pos+13) = '_' && String.unsafe_get s (pos+14) = 't' && String.unsafe_get s (pos+15) = 'r' && String.unsafe_get s (pos+16) = 'a' && String.unsafe_get s (pos+17) = 'c' && String.unsafe_get s (pos+18) = 'e' && String.unsafe_get s (pos+19) = 's' then ( - 5 + | 9 -> ( + if String.unsafe_get s pos = 's' && String.unsafe_get s (pos+1) = 'h' && String.unsafe_get s (pos+2) = 'o' && String.unsafe_get s (pos+3) = 'r' && String.unsafe_get s (pos+4) = 't' && String.unsafe_get s (pos+5) = '_' && String.unsafe_get s (pos+6) = 'm' && String.unsafe_get s (pos+7) = 's' && String.unsafe_get s (pos+8) = 'g' then ( + 7 ) else ( -1 @@ -20827,51 +20623,95 @@ let read_sarif_format_params = ( ( match i with | 0 -> - field_hide_nudge := ( + field_code := ( Some ( ( - Atdgen_runtime.Oj_run.read_bool + Atdgen_runtime.Oj_run.read_int ) p lb ) ); | 1 -> - field_engine_label := ( + field_level := ( Some ( ( - Atdgen_runtime.Oj_run.read_string + read_error_severity ) p lb ) ); | 2 -> - field_rules := ( + field_type_ := ( Some ( ( - read_fpath + read_error_type ) p lb ) ); | 3 -> - field_cli_matches := ( - Some ( - ( - read__cli_match_list - ) p lb - ) - ); + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_rule_id := ( + Some ( + ( + read_rule_id + ) p lb + ) + ); + ) | 4 -> - field_cli_errors := ( - Some ( - ( - read__cli_error_list - ) p lb - ) - ); + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_message := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_string + ) p lb + ) + ); + ) | 5 -> if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_show_dataflow_traces := ( + field_path := ( Some ( ( - Atdgen_runtime.Oj_run.read_bool + read_fpath + ) p lb + ) + ); + ) + | 6 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_long_msg := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_string + ) p lb + ) + ); + ) + | 7 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_short_msg := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_string + ) p lb + ) + ); + ) + | 8 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_spans := ( + Some ( + ( + read__error_span_list + ) p lb + ) + ); + ) + | 9 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_help := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_string ) p lb ) ); @@ -20889,27 +20729,79 @@ let read_sarif_format_params = ( if pos < 0 || len < 0 || pos + len > String.length s then invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); match len with + | 4 -> ( + match String.unsafe_get s pos with + | 'c' -> ( + if String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'd' && String.unsafe_get s (pos+3) = 'e' then ( + 0 + ) + else ( + -1 + ) + ) + | 'h' -> ( + if String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'l' && String.unsafe_get s (pos+3) = 'p' then ( + 9 + ) + else ( + -1 + ) + ) + | 'p' -> ( + if String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'h' then ( + 5 + ) + else ( + -1 + ) + ) + | 't' -> ( + if String.unsafe_get s (pos+1) = 'y' && String.unsafe_get s (pos+2) = 'p' && String.unsafe_get s (pos+3) = 'e' then ( + 2 + ) + else ( + -1 + ) + ) + | _ -> ( + -1 + ) + ) | 5 -> ( - if String.unsafe_get s pos = 'r' && String.unsafe_get s (pos+1) = 'u' && String.unsafe_get s (pos+2) = 'l' && String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = 's' then ( - 2 - ) - else ( - -1 - ) + match String.unsafe_get s pos with + | 'l' -> ( + if String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'v' && String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = 'l' then ( + 1 + ) + else ( + -1 + ) + ) + | 's' -> ( + if String.unsafe_get s (pos+1) = 'p' && String.unsafe_get s (pos+2) = 'a' && String.unsafe_get s (pos+3) = 'n' && String.unsafe_get s (pos+4) = 's' then ( + 8 + ) + else ( + -1 + ) + ) + | _ -> ( + -1 + ) ) - | 10 -> ( + | 7 -> ( match String.unsafe_get s pos with - | 'c' -> ( - if String.unsafe_get s (pos+1) = 'l' && String.unsafe_get s (pos+2) = 'i' && String.unsafe_get s (pos+3) = '_' && String.unsafe_get s (pos+4) = 'e' && String.unsafe_get s (pos+5) = 'r' && String.unsafe_get s (pos+6) = 'r' && String.unsafe_get s (pos+7) = 'o' && String.unsafe_get s (pos+8) = 'r' && String.unsafe_get s (pos+9) = 's' then ( + | 'm' -> ( + if String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 's' && String.unsafe_get s (pos+3) = 's' && String.unsafe_get s (pos+4) = 'a' && String.unsafe_get s (pos+5) = 'g' && String.unsafe_get s (pos+6) = 'e' then ( 4 ) else ( -1 ) ) - | 'h' -> ( - if String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = 'd' && String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = '_' && String.unsafe_get s (pos+5) = 'n' && String.unsafe_get s (pos+6) = 'u' && String.unsafe_get s (pos+7) = 'd' && String.unsafe_get s (pos+8) = 'g' && String.unsafe_get s (pos+9) = 'e' then ( - 0 + | 'r' -> ( + if String.unsafe_get s (pos+1) = 'u' && String.unsafe_get s (pos+2) = 'l' && String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = '_' && String.unsafe_get s (pos+5) = 'i' && String.unsafe_get s (pos+6) = 'd' then ( + 3 ) else ( -1 @@ -20919,25 +20811,17 @@ let read_sarif_format_params = ( -1 ) ) - | 11 -> ( - if String.unsafe_get s pos = 'c' && String.unsafe_get s (pos+1) = 'l' && String.unsafe_get s (pos+2) = 'i' && String.unsafe_get s (pos+3) = '_' && String.unsafe_get s (pos+4) = 'm' && String.unsafe_get s (pos+5) = 'a' && String.unsafe_get s (pos+6) = 't' && String.unsafe_get s (pos+7) = 'c' && String.unsafe_get s (pos+8) = 'h' && String.unsafe_get s (pos+9) = 'e' && String.unsafe_get s (pos+10) = 's' then ( - 3 - ) - else ( - -1 - ) - ) - | 12 -> ( - if String.unsafe_get s pos = 'e' && String.unsafe_get s (pos+1) = 'n' && String.unsafe_get s (pos+2) = 'g' && String.unsafe_get s (pos+3) = 'i' && String.unsafe_get s (pos+4) = 'n' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 'l' && String.unsafe_get s (pos+8) = 'a' && String.unsafe_get s (pos+9) = 'b' && String.unsafe_get s (pos+10) = 'e' && String.unsafe_get s (pos+11) = 'l' then ( - 1 + | 8 -> ( + if String.unsafe_get s pos = 'l' && String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = 'g' && String.unsafe_get s (pos+4) = '_' && String.unsafe_get s (pos+5) = 'm' && String.unsafe_get s (pos+6) = 's' && String.unsafe_get s (pos+7) = 'g' then ( + 6 ) else ( -1 ) ) - | 20 -> ( - if String.unsafe_get s pos = 's' && String.unsafe_get s (pos+1) = 'h' && String.unsafe_get s (pos+2) = 'o' && String.unsafe_get s (pos+3) = 'w' && String.unsafe_get s (pos+4) = '_' && String.unsafe_get s (pos+5) = 'd' && String.unsafe_get s (pos+6) = 'a' && String.unsafe_get s (pos+7) = 't' && String.unsafe_get s (pos+8) = 'a' && String.unsafe_get s (pos+9) = 'f' && String.unsafe_get s (pos+10) = 'l' && String.unsafe_get s (pos+11) = 'o' && String.unsafe_get s (pos+12) = 'w' && String.unsafe_get s (pos+13) = '_' && String.unsafe_get s (pos+14) = 't' && String.unsafe_get s (pos+15) = 'r' && String.unsafe_get s (pos+16) = 'a' && String.unsafe_get s (pos+17) = 'c' && String.unsafe_get s (pos+18) = 'e' && String.unsafe_get s (pos+19) = 's' then ( - 5 + | 9 -> ( + if String.unsafe_get s pos = 's' && String.unsafe_get s (pos+1) = 'h' && String.unsafe_get s (pos+2) = 'o' && String.unsafe_get s (pos+3) = 'r' && String.unsafe_get s (pos+4) = 't' && String.unsafe_get s (pos+5) = '_' && String.unsafe_get s (pos+6) = 'm' && String.unsafe_get s (pos+7) = 's' && String.unsafe_get s (pos+8) = 'g' then ( + 7 ) else ( -1 @@ -20952,51 +20836,95 @@ let read_sarif_format_params = ( ( match i with | 0 -> - field_hide_nudge := ( + field_code := ( Some ( ( - Atdgen_runtime.Oj_run.read_bool + Atdgen_runtime.Oj_run.read_int ) p lb ) ); | 1 -> - field_engine_label := ( + field_level := ( Some ( ( - Atdgen_runtime.Oj_run.read_string + read_error_severity ) p lb ) ); | 2 -> - field_rules := ( + field_type_ := ( Some ( ( - read_fpath + read_error_type ) p lb ) ); | 3 -> - field_cli_matches := ( - Some ( - ( - read__cli_match_list - ) p lb - ) - ); + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_rule_id := ( + Some ( + ( + read_rule_id + ) p lb + ) + ); + ) | 4 -> - field_cli_errors := ( - Some ( - ( - read__cli_error_list - ) p lb - ) - ); + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_message := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_string + ) p lb + ) + ); + ) | 5 -> if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_show_dataflow_traces := ( + field_path := ( Some ( ( - Atdgen_runtime.Oj_run.read_bool + read_fpath + ) p lb + ) + ); + ) + | 6 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_long_msg := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_string + ) p lb + ) + ); + ) + | 7 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_short_msg := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_string + ) p lb + ) + ); + ) + | 8 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_spans := ( + Some ( + ( + read__error_span_list + ) p lb + ) + ); + ) + | 9 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_help := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_string ) p lb ) ); @@ -21010,162 +20938,130 @@ let read_sarif_format_params = ( with Yojson.End_of_object -> ( ( { - hide_nudge = (match !field_hide_nudge with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "hide_nudge"); - engine_label = (match !field_engine_label with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "engine_label"); - rules = (match !field_rules with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "rules"); - cli_matches = (match !field_cli_matches with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "cli_matches"); - cli_errors = (match !field_cli_errors with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "cli_errors"); - show_dataflow_traces = !field_show_dataflow_traces; + code = (match !field_code with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "code"); + level = (match !field_level with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "level"); + type_ = (match !field_type_ with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "type_"); + rule_id = !field_rule_id; + message = !field_message; + path = !field_path; + long_msg = !field_long_msg; + short_msg = !field_short_msg; + spans = !field_spans; + help = !field_help; } - : sarif_format_params) + : cli_error) ) ) -let sarif_format_params_of_string s = - read_sarif_format_params (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_engine_kind = ( - fun ob x -> - match x with - | `OSS -> Buffer.add_string ob "\"OSS\"" - | `PRO -> Buffer.add_string ob "\"PRO\"" -) -let string_of_engine_kind ?(len = 1024) x = - let ob = Buffer.create len in - write_engine_kind ob x; - Buffer.contents ob -let read_engine_kind = ( - fun p lb -> - Yojson.Safe.read_space p lb; - match Yojson.Safe.start_any_variant p lb with - | `Edgy_bracket -> ( - match Yojson.Safe.read_ident p lb with - | "OSS" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `OSS - | "PRO" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `PRO - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Double_quote -> ( - match Yojson.Safe.finish_string p lb with - | "OSS" -> - `OSS - | "PRO" -> - `PRO - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Square_bracket -> ( - match Atdgen_runtime.Oj_run.read_string p lb with - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) -) -let engine_kind_of_string s = - read_engine_kind (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_rule_id_and_engine_kind = ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _ = x in - ( - write_rule_id - ) ob x - ); - Buffer.add_char ob ','; - (let _, x = x in - ( - write_engine_kind - ) ob x - ); - Buffer.add_char ob ']'; -) -let string_of_rule_id_and_engine_kind ?(len = 1024) x = - let ob = Buffer.create len in - write_rule_id_and_engine_kind ob x; - Buffer.contents ob -let read_rule_id_and_engine_kind = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_rule_id - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_engine_kind - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); +let cli_error_of_string s = + read_cli_error (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write__cli_match_list = ( + Atdgen_runtime.Oj_run.write_list ( + write_cli_match + ) ) -let rule_id_and_engine_kind_of_string s = - read_rule_id_and_engine_kind (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_resolution_cmd_failed : _ -> resolution_cmd_failed -> _ = ( - fun ob (x : resolution_cmd_failed) -> +let string_of__cli_match_list ?(len = 1024) x = + let ob = Buffer.create len in + write__cli_match_list ob x; + Buffer.contents ob +let read__cli_match_list = ( + Atdgen_runtime.Oj_run.read_list ( + read_cli_match + ) +) +let _cli_match_list_of_string s = + read__cli_match_list (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write__cli_error_list = ( + Atdgen_runtime.Oj_run.write_list ( + write_cli_error + ) +) +let string_of__cli_error_list ?(len = 1024) x = + let ob = Buffer.create len in + write__cli_error_list ob x; + Buffer.contents ob +let read__cli_error_list = ( + Atdgen_runtime.Oj_run.read_list ( + read_cli_error + ) +) +let _cli_error_list_of_string s = + read__cli_error_list (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_sarif_format_params : _ -> sarif_format_params -> _ = ( + fun ob (x : sarif_format_params) -> Buffer.add_char ob '{'; let is_first = ref true in if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"command\":"; + Buffer.add_string ob "\"hide_nudge\":"; ( - Yojson.Safe.write_string + Yojson.Safe.write_bool ) - ob x.command; + ob x.hide_nudge; if !is_first then is_first := false else Buffer.add_char ob ','; - Buffer.add_string ob "\"message\":"; + Buffer.add_string ob "\"engine_label\":"; ( Yojson.Safe.write_string ) - ob x.message; + ob x.engine_label; + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"rules\":"; + ( + write_fpath + ) + ob x.rules; + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"cli_matches\":"; + ( + write__cli_match_list + ) + ob x.cli_matches; + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"cli_errors\":"; + ( + write__cli_error_list + ) + ob x.cli_errors; + (match x.show_dataflow_traces with None -> () | Some x -> + if !is_first then + is_first := false + else + Buffer.add_char ob ','; + Buffer.add_string ob "\"show_dataflow_traces\":"; + ( + Yojson.Safe.write_bool + ) + ob x; + ); Buffer.add_char ob '}'; ) -let string_of_resolution_cmd_failed ?(len = 1024) x = +let string_of_sarif_format_params ?(len = 1024) x = let ob = Buffer.create len in - write_resolution_cmd_failed ob x; + write_sarif_format_params ob x; Buffer.contents ob -let read_resolution_cmd_failed = ( +let read_sarif_format_params = ( fun p lb -> Yojson.Safe.read_space p lb; Yojson.Safe.read_lcurl p lb; - let field_command = ref (None) in - let field_message = ref (None) in + let field_hide_nudge = ref (None) in + let field_engine_label = ref (None) in + let field_rules = ref (None) in + let field_cli_matches = ref (None) in + let field_cli_errors = ref (None) in + let field_show_dataflow_traces = ref (None) in try Yojson.Safe.read_space p lb; Yojson.Safe.read_object_end lb; @@ -21174,52 +21070,119 @@ let read_resolution_cmd_failed = ( fun s pos len -> if pos < 0 || len < 0 || pos + len > String.length s then invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); - if len = 7 then ( - match String.unsafe_get s pos with - | 'c' -> ( - if String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'm' && String.unsafe_get s (pos+3) = 'm' && String.unsafe_get s (pos+4) = 'a' && String.unsafe_get s (pos+5) = 'n' && String.unsafe_get s (pos+6) = 'd' then ( - 0 - ) - else ( - -1 - ) + match len with + | 5 -> ( + if String.unsafe_get s pos = 'r' && String.unsafe_get s (pos+1) = 'u' && String.unsafe_get s (pos+2) = 'l' && String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = 's' then ( + 2 ) - | 'm' -> ( - if String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 's' && String.unsafe_get s (pos+3) = 's' && String.unsafe_get s (pos+4) = 'a' && String.unsafe_get s (pos+5) = 'g' && String.unsafe_get s (pos+6) = 'e' then ( - 1 - ) - else ( - -1 - ) + else ( + -1 ) - | _ -> ( + ) + | 10 -> ( + match String.unsafe_get s pos with + | 'c' -> ( + if String.unsafe_get s (pos+1) = 'l' && String.unsafe_get s (pos+2) = 'i' && String.unsafe_get s (pos+3) = '_' && String.unsafe_get s (pos+4) = 'e' && String.unsafe_get s (pos+5) = 'r' && String.unsafe_get s (pos+6) = 'r' && String.unsafe_get s (pos+7) = 'o' && String.unsafe_get s (pos+8) = 'r' && String.unsafe_get s (pos+9) = 's' then ( + 4 + ) + else ( + -1 + ) + ) + | 'h' -> ( + if String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = 'd' && String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = '_' && String.unsafe_get s (pos+5) = 'n' && String.unsafe_get s (pos+6) = 'u' && String.unsafe_get s (pos+7) = 'd' && String.unsafe_get s (pos+8) = 'g' && String.unsafe_get s (pos+9) = 'e' then ( + 0 + ) + else ( + -1 + ) + ) + | _ -> ( + -1 + ) + ) + | 11 -> ( + if String.unsafe_get s pos = 'c' && String.unsafe_get s (pos+1) = 'l' && String.unsafe_get s (pos+2) = 'i' && String.unsafe_get s (pos+3) = '_' && String.unsafe_get s (pos+4) = 'm' && String.unsafe_get s (pos+5) = 'a' && String.unsafe_get s (pos+6) = 't' && String.unsafe_get s (pos+7) = 'c' && String.unsafe_get s (pos+8) = 'h' && String.unsafe_get s (pos+9) = 'e' && String.unsafe_get s (pos+10) = 's' then ( + 3 + ) + else ( -1 ) - ) - else ( - -1 - ) + ) + | 12 -> ( + if String.unsafe_get s pos = 'e' && String.unsafe_get s (pos+1) = 'n' && String.unsafe_get s (pos+2) = 'g' && String.unsafe_get s (pos+3) = 'i' && String.unsafe_get s (pos+4) = 'n' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 'l' && String.unsafe_get s (pos+8) = 'a' && String.unsafe_get s (pos+9) = 'b' && String.unsafe_get s (pos+10) = 'e' && String.unsafe_get s (pos+11) = 'l' then ( + 1 + ) + else ( + -1 + ) + ) + | 20 -> ( + if String.unsafe_get s pos = 's' && String.unsafe_get s (pos+1) = 'h' && String.unsafe_get s (pos+2) = 'o' && String.unsafe_get s (pos+3) = 'w' && String.unsafe_get s (pos+4) = '_' && String.unsafe_get s (pos+5) = 'd' && String.unsafe_get s (pos+6) = 'a' && String.unsafe_get s (pos+7) = 't' && String.unsafe_get s (pos+8) = 'a' && String.unsafe_get s (pos+9) = 'f' && String.unsafe_get s (pos+10) = 'l' && String.unsafe_get s (pos+11) = 'o' && String.unsafe_get s (pos+12) = 'w' && String.unsafe_get s (pos+13) = '_' && String.unsafe_get s (pos+14) = 't' && String.unsafe_get s (pos+15) = 'r' && String.unsafe_get s (pos+16) = 'a' && String.unsafe_get s (pos+17) = 'c' && String.unsafe_get s (pos+18) = 'e' && String.unsafe_get s (pos+19) = 's' then ( + 5 + ) + else ( + -1 + ) + ) + | _ -> ( + -1 + ) in let i = Yojson.Safe.map_ident p f lb in Atdgen_runtime.Oj_run.read_until_field_value p lb; ( match i with | 0 -> - field_command := ( + field_hide_nudge := ( Some ( ( - Atdgen_runtime.Oj_run.read_string + Atdgen_runtime.Oj_run.read_bool ) p lb ) ); | 1 -> - field_message := ( + field_engine_label := ( Some ( ( Atdgen_runtime.Oj_run.read_string ) p lb ) ); + | 2 -> + field_rules := ( + Some ( + ( + read_fpath + ) p lb + ) + ); + | 3 -> + field_cli_matches := ( + Some ( + ( + read__cli_match_list + ) p lb + ) + ); + | 4 -> + field_cli_errors := ( + Some ( + ( + read__cli_error_list + ) p lb + ) + ); + | 5 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_show_dataflow_traces := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_bool + ) p lb + ) + ); + ) | _ -> ( Yojson.Safe.skip_json p lb ) @@ -21232,52 +21195,119 @@ let read_resolution_cmd_failed = ( fun s pos len -> if pos < 0 || len < 0 || pos + len > String.length s then invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); - if len = 7 then ( - match String.unsafe_get s pos with - | 'c' -> ( - if String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'm' && String.unsafe_get s (pos+3) = 'm' && String.unsafe_get s (pos+4) = 'a' && String.unsafe_get s (pos+5) = 'n' && String.unsafe_get s (pos+6) = 'd' then ( - 0 - ) - else ( - -1 - ) + match len with + | 5 -> ( + if String.unsafe_get s pos = 'r' && String.unsafe_get s (pos+1) = 'u' && String.unsafe_get s (pos+2) = 'l' && String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = 's' then ( + 2 + ) + else ( + -1 + ) + ) + | 10 -> ( + match String.unsafe_get s pos with + | 'c' -> ( + if String.unsafe_get s (pos+1) = 'l' && String.unsafe_get s (pos+2) = 'i' && String.unsafe_get s (pos+3) = '_' && String.unsafe_get s (pos+4) = 'e' && String.unsafe_get s (pos+5) = 'r' && String.unsafe_get s (pos+6) = 'r' && String.unsafe_get s (pos+7) = 'o' && String.unsafe_get s (pos+8) = 'r' && String.unsafe_get s (pos+9) = 's' then ( + 4 + ) + else ( + -1 + ) + ) + | 'h' -> ( + if String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = 'd' && String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = '_' && String.unsafe_get s (pos+5) = 'n' && String.unsafe_get s (pos+6) = 'u' && String.unsafe_get s (pos+7) = 'd' && String.unsafe_get s (pos+8) = 'g' && String.unsafe_get s (pos+9) = 'e' then ( + 0 + ) + else ( + -1 + ) + ) + | _ -> ( + -1 + ) + ) + | 11 -> ( + if String.unsafe_get s pos = 'c' && String.unsafe_get s (pos+1) = 'l' && String.unsafe_get s (pos+2) = 'i' && String.unsafe_get s (pos+3) = '_' && String.unsafe_get s (pos+4) = 'm' && String.unsafe_get s (pos+5) = 'a' && String.unsafe_get s (pos+6) = 't' && String.unsafe_get s (pos+7) = 'c' && String.unsafe_get s (pos+8) = 'h' && String.unsafe_get s (pos+9) = 'e' && String.unsafe_get s (pos+10) = 's' then ( + 3 ) - | 'm' -> ( - if String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 's' && String.unsafe_get s (pos+3) = 's' && String.unsafe_get s (pos+4) = 'a' && String.unsafe_get s (pos+5) = 'g' && String.unsafe_get s (pos+6) = 'e' then ( - 1 - ) - else ( - -1 - ) + else ( + -1 ) - | _ -> ( + ) + | 12 -> ( + if String.unsafe_get s pos = 'e' && String.unsafe_get s (pos+1) = 'n' && String.unsafe_get s (pos+2) = 'g' && String.unsafe_get s (pos+3) = 'i' && String.unsafe_get s (pos+4) = 'n' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 'l' && String.unsafe_get s (pos+8) = 'a' && String.unsafe_get s (pos+9) = 'b' && String.unsafe_get s (pos+10) = 'e' && String.unsafe_get s (pos+11) = 'l' then ( + 1 + ) + else ( -1 ) - ) - else ( - -1 - ) + ) + | 20 -> ( + if String.unsafe_get s pos = 's' && String.unsafe_get s (pos+1) = 'h' && String.unsafe_get s (pos+2) = 'o' && String.unsafe_get s (pos+3) = 'w' && String.unsafe_get s (pos+4) = '_' && String.unsafe_get s (pos+5) = 'd' && String.unsafe_get s (pos+6) = 'a' && String.unsafe_get s (pos+7) = 't' && String.unsafe_get s (pos+8) = 'a' && String.unsafe_get s (pos+9) = 'f' && String.unsafe_get s (pos+10) = 'l' && String.unsafe_get s (pos+11) = 'o' && String.unsafe_get s (pos+12) = 'w' && String.unsafe_get s (pos+13) = '_' && String.unsafe_get s (pos+14) = 't' && String.unsafe_get s (pos+15) = 'r' && String.unsafe_get s (pos+16) = 'a' && String.unsafe_get s (pos+17) = 'c' && String.unsafe_get s (pos+18) = 'e' && String.unsafe_get s (pos+19) = 's' then ( + 5 + ) + else ( + -1 + ) + ) + | _ -> ( + -1 + ) in let i = Yojson.Safe.map_ident p f lb in Atdgen_runtime.Oj_run.read_until_field_value p lb; ( match i with | 0 -> - field_command := ( + field_hide_nudge := ( Some ( ( - Atdgen_runtime.Oj_run.read_string + Atdgen_runtime.Oj_run.read_bool ) p lb ) ); | 1 -> - field_message := ( + field_engine_label := ( Some ( ( Atdgen_runtime.Oj_run.read_string ) p lb ) ); + | 2 -> + field_rules := ( + Some ( + ( + read_fpath + ) p lb + ) + ); + | 3 -> + field_cli_matches := ( + Some ( + ( + read__cli_match_list + ) p lb + ) + ); + | 4 -> + field_cli_errors := ( + Some ( + ( + read__cli_error_list + ) p lb + ) + ); + | 5 -> + if not (Yojson.Safe.read_null_if_possible p lb) then ( + field_show_dataflow_traces := ( + Some ( + ( + Atdgen_runtime.Oj_run.read_bool + ) p lb + ) + ); + ) | _ -> ( Yojson.Safe.skip_json p lb ) @@ -21287,129 +21317,128 @@ let read_resolution_cmd_failed = ( with Yojson.End_of_object -> ( ( { - command = (match !field_command with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "command"); - message = (match !field_message with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "message"); + hide_nudge = (match !field_hide_nudge with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "hide_nudge"); + engine_label = (match !field_engine_label with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "engine_label"); + rules = (match !field_rules with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "rules"); + cli_matches = (match !field_cli_matches with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "cli_matches"); + cli_errors = (match !field_cli_errors with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "cli_errors"); + show_dataflow_traces = !field_show_dataflow_traces; } - : resolution_cmd_failed) + : sarif_format_params) ) ) -let resolution_cmd_failed_of_string s = - read_resolution_cmd_failed (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_resolution_error = ( +let sarif_format_params_of_string s = + read_sarif_format_params (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_engine_kind = ( fun ob x -> match x with - | `UnsupportedManifest -> Buffer.add_string ob "\"UnsupportedManifest\"" - | `MissingRequirement x -> - Buffer.add_string ob "[\"MissingRequirement\","; - ( - Yojson.Safe.write_string - ) ob x; - Buffer.add_char ob ']' - | `ResolutionCmdFailed x -> - Buffer.add_string ob "[\"ResolutionCmdFailed\","; - ( - write_resolution_cmd_failed - ) ob x; - Buffer.add_char ob ']' - | `ParseDependenciesFailed x -> - Buffer.add_string ob "[\"ParseDependenciesFailed\","; - ( - Yojson.Safe.write_string - ) ob x; - Buffer.add_char ob ']' + | `OSS -> Buffer.add_string ob "\"OSS\"" + | `PRO -> Buffer.add_string ob "\"PRO\"" ) -let string_of_resolution_error ?(len = 1024) x = +let string_of_engine_kind ?(len = 1024) x = let ob = Buffer.create len in - write_resolution_error ob x; + write_engine_kind ob x; Buffer.contents ob -let read_resolution_error = ( +let read_engine_kind = ( fun p lb -> Yojson.Safe.read_space p lb; match Yojson.Safe.start_any_variant p lb with | `Edgy_bracket -> ( match Yojson.Safe.read_ident p lb with - | "UnsupportedManifest" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `UnsupportedManifest - | "MissingRequirement" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - Atdgen_runtime.Oj_run.read_string - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `MissingRequirement x - | "ResolutionCmdFailed" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read_resolution_cmd_failed - ) p lb - in + | "OSS" -> Yojson.Safe.read_space p lb; Yojson.Safe.read_gt p lb; - `ResolutionCmdFailed x - | "ParseDependenciesFailed" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - Atdgen_runtime.Oj_run.read_string - ) p lb - in + `OSS + | "PRO" -> Yojson.Safe.read_space p lb; Yojson.Safe.read_gt p lb; - `ParseDependenciesFailed x + `PRO | x -> Atdgen_runtime.Oj_run.invalid_variant_tag p x ) | `Double_quote -> ( match Yojson.Safe.finish_string p lb with - | "UnsupportedManifest" -> - `UnsupportedManifest + | "OSS" -> + `OSS + | "PRO" -> + `PRO | x -> Atdgen_runtime.Oj_run.invalid_variant_tag p x ) | `Square_bracket -> ( match Atdgen_runtime.Oj_run.read_string p lb with - | "MissingRequirement" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - Atdgen_runtime.Oj_run.read_string - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `MissingRequirement x - | "ResolutionCmdFailed" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read_resolution_cmd_failed - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `ResolutionCmdFailed x - | "ParseDependenciesFailed" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - Atdgen_runtime.Oj_run.read_string - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `ParseDependenciesFailed x | x -> Atdgen_runtime.Oj_run.invalid_variant_tag p x ) ) -let resolution_error_of_string s = - read_resolution_error (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let engine_kind_of_string s = + read_engine_kind (Yojson.Safe.init_lexer ()) (Lexing.from_string s) +let write_rule_id_and_engine_kind = ( + fun ob x -> + Buffer.add_char ob '['; + (let x, _ = x in + ( + write_rule_id + ) ob x + ); + Buffer.add_char ob ','; + (let _, x = x in + ( + write_engine_kind + ) ob x + ); + Buffer.add_char ob ']'; +) +let string_of_rule_id_and_engine_kind ?(len = 1024) x = + let ob = Buffer.create len in + write_rule_id_and_engine_kind ob x; + Buffer.contents ob +let read_rule_id_and_engine_kind = ( + fun p lb -> + Yojson.Safe.read_space p lb; + let std_tuple = Yojson.Safe.start_any_tuple p lb in + let len = ref 0 in + let end_of_tuple = ref false in + (try + let x0 = + let x = + ( + read_rule_id + ) p lb + in + incr len; + Yojson.Safe.read_space p lb; + Yojson.Safe.read_tuple_sep2 p std_tuple lb; + x + in + let x1 = + let x = + ( + read_engine_kind + ) p lb + in + incr len; + (try + Yojson.Safe.read_space p lb; + Yojson.Safe.read_tuple_sep2 p std_tuple lb; + with Yojson.End_of_tuple -> end_of_tuple := true); + x + in + if not !end_of_tuple then ( + try + while true do + Yojson.Safe.skip_json p lb; + Yojson.Safe.read_space p lb; + Yojson.Safe.read_tuple_sep2 p std_tuple lb; + done + with Yojson.End_of_tuple -> () + ); + (x0, x1) + with Yojson.End_of_tuple -> + Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); +) +let rule_id_and_engine_kind_of_string s = + read_rule_id_and_engine_kind (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let write__found_dependency_list = ( Atdgen_runtime.Oj_run.write_list ( write_found_dependency diff --git a/semgrep_output_v1_j.mli b/semgrep_output_v1_j.mli index aa8cb38d..ee71592f 100644 --- a/semgrep_output_v1_j.mli +++ b/semgrep_output_v1_j.mli @@ -431,6 +431,15 @@ type sarif_format_return = Semgrep_output_v1_t.sarif_format_return = { format_time_seconds: float } +type resolution_cmd_failed = Semgrep_output_v1_t.resolution_cmd_failed = { + command: string; + message: string +} + [@@deriving show] + +type resolution_error = Semgrep_output_v1_t.resolution_error + [@@deriving show] + type incompatible_rule = Semgrep_output_v1_t.incompatible_rule = { rule_id: rule_id; this_version: version; @@ -465,6 +474,7 @@ type error_type = Semgrep_output_v1_t.error_type = | IncompatibleRule of incompatible_rule | PatternParseError0 | IncompatibleRule0 + | DependencyResolutionError of resolution_error [@@deriving show] @@ -535,13 +545,6 @@ type engine_kind = Semgrep_output_v1_t.engine_kind [@@deriving show] type rule_id_and_engine_kind = Semgrep_output_v1_t.rule_id_and_engine_kind -type resolution_cmd_failed = Semgrep_output_v1_t.resolution_cmd_failed = { - command: string; - message: string -} - -type resolution_error = Semgrep_output_v1_t.resolution_error - type resolution_result = Semgrep_output_v1_t.resolution_result type profile = Semgrep_output_v1_t.profile = { @@ -2310,6 +2313,46 @@ val sarif_format_return_of_string : string -> sarif_format_return (** Deserialize JSON data of type {!type:sarif_format_return}. *) +val write_resolution_cmd_failed : + Buffer.t -> resolution_cmd_failed -> unit + (** Output a JSON value of type {!type:resolution_cmd_failed}. *) + +val string_of_resolution_cmd_failed : + ?len:int -> resolution_cmd_failed -> string + (** Serialize a value of type {!type:resolution_cmd_failed} + into a JSON string. + @param len specifies the initial length + of the buffer used internally. + Default: 1024. *) + +val read_resolution_cmd_failed : + Yojson.Safe.lexer_state -> Lexing.lexbuf -> resolution_cmd_failed + (** Input JSON data of type {!type:resolution_cmd_failed}. *) + +val resolution_cmd_failed_of_string : + string -> resolution_cmd_failed + (** Deserialize JSON data of type {!type:resolution_cmd_failed}. *) + +val write_resolution_error : + Buffer.t -> resolution_error -> unit + (** Output a JSON value of type {!type:resolution_error}. *) + +val string_of_resolution_error : + ?len:int -> resolution_error -> string + (** Serialize a value of type {!type:resolution_error} + into a JSON string. + @param len specifies the initial length + of the buffer used internally. + Default: 1024. *) + +val read_resolution_error : + Yojson.Safe.lexer_state -> Lexing.lexbuf -> resolution_error + (** Input JSON data of type {!type:resolution_error}. *) + +val resolution_error_of_string : + string -> resolution_error + (** Deserialize JSON data of type {!type:resolution_error}. *) + val write_incompatible_rule : Buffer.t -> incompatible_rule -> unit (** Output a JSON value of type {!type:incompatible_rule}. *) @@ -2510,46 +2553,6 @@ val rule_id_and_engine_kind_of_string : string -> rule_id_and_engine_kind (** Deserialize JSON data of type {!type:rule_id_and_engine_kind}. *) -val write_resolution_cmd_failed : - Buffer.t -> resolution_cmd_failed -> unit - (** Output a JSON value of type {!type:resolution_cmd_failed}. *) - -val string_of_resolution_cmd_failed : - ?len:int -> resolution_cmd_failed -> string - (** Serialize a value of type {!type:resolution_cmd_failed} - into a JSON string. - @param len specifies the initial length - of the buffer used internally. - Default: 1024. *) - -val read_resolution_cmd_failed : - Yojson.Safe.lexer_state -> Lexing.lexbuf -> resolution_cmd_failed - (** Input JSON data of type {!type:resolution_cmd_failed}. *) - -val resolution_cmd_failed_of_string : - string -> resolution_cmd_failed - (** Deserialize JSON data of type {!type:resolution_cmd_failed}. *) - -val write_resolution_error : - Buffer.t -> resolution_error -> unit - (** Output a JSON value of type {!type:resolution_error}. *) - -val string_of_resolution_error : - ?len:int -> resolution_error -> string - (** Serialize a value of type {!type:resolution_error} - into a JSON string. - @param len specifies the initial length - of the buffer used internally. - Default: 1024. *) - -val read_resolution_error : - Yojson.Safe.lexer_state -> Lexing.lexbuf -> resolution_error - (** Input JSON data of type {!type:resolution_error}. *) - -val resolution_error_of_string : - string -> resolution_error - (** Deserialize JSON data of type {!type:resolution_error}. *) - val write_resolution_result : Buffer.t -> resolution_result -> unit (** Output a JSON value of type {!type:resolution_result}. *)