{
	"scopeName": "go.mod",
	"patterns": [
		{
			"include": "#comments"
		},
		{
			"include": "#directive"
		},
		{
			"include": "#invalid"
		}
	],
	"repository": {
		"directive": {
			"patterns": [
				{
					"comment": "Multi-Line directive",
					"begin": "(\\w+)\\s*\\(",
					"beginCaptures": {
						"1": {
							"name": "keyword.go.mod"
						}
					},
					"end": "\\)",
					"patterns": [
						{
							"include": "#arguments"
						}
					]
				},
				{
					"comment": "Single-Line directive",
					"match": "(\\w+)\\s*(.*)",
					"captures": {
						"1": {
							"name": "keyword.go.mod"
						},
						"2": {
							"patterns": [
								{
									"include": "#arguments"
								}
							]
						}
					}
				}
			]
		},
		"arguments": {
			"patterns": [
				{
					"include": "#comments"
				},
				{
					"include": "#double_quoted_string"
				},
				{
					"include": "#raw_quoted_string"
				},
				{
					"include": "#operator"
				},
				{
					"include": "#semver"
				},
				{
					"include": "#semver_range"
				},
				{
					"include": "#unquoted_string"
				}
			]
		},
		"comments": {
			"patterns": [
				{
					"begin": "//",
					"beginCaptures": {
						"0": {
							"name": "punctuation.definition.comment.go.mod"
						}
					},
					"end": "$",
					"name": "comment.line.double-slash.go.mod"
				}
			]
		},
		"operator": {
			"match": "(=>)",
			"name": "operator.go.mod"
		},
		"unquoted_string": {
			"comment": "Unquoted string",
			"match": "([^\\s/]|/(?!/))+",
			"name": "string.unquoted.go.mod"
		},
		"double_quoted_string": {
			"comment": "Interpreted string literals",
			"begin": "\"",
			"beginCaptures": {
				"0": {
					"name": "punctuation.definition.string.begin.go.mod"
				}
			},
			"end": "\"",
			"endCaptures": {
				"0": {
					"name": "punctuation.definition.string.end.go.mod"
				}
			},
			"name": "string.quoted.double",
			"patterns": [
				{
					"include": "#string_escaped_char"
				},
				{
					"include": "#string_placeholder"
				}
			]
		},
		"raw_quoted_string": {
			"comment": "Raw string literals",
			"begin": "`",
			"beginCaptures": {
				"0": {
					"name": "punctuation.definition.string.begin.go.mod"
				}
			},
			"end": "`",
			"endCaptures": {
				"0": {
					"name": "punctuation.definition.string.end.go.mod"
				}
			},
			"name": "string.quoted.raw",
			"patterns": [
				{
					"include": "#string_placeholder"
				}
			]
		},
		"semver": {
			"comment": "Semver version strings (v1.2.3)",
			"match": "v(?:0|[1-9]\\d*)\\.(?:0|[1-9]\\d*)\\.(?:0|[1-9]\\d*)(?:-[\\da-z-]+(?:\\.[\\da-z-]+)*)?(?:\\+[\\da-z-]+(?:\\.[\\da-z-]+)*)?",
			"name": "constant.language.go.mod"
		},
		"semver_range": {
			"begin": "\\[",
			"patterns": [
				{
					"include": "#semver"
				}
			],
			"end": "\\]"
		},
		"string_escaped_char": {
			"patterns": [
				{
					"match": "\\\\([0-7]{3}|[abfnrtv\\\\'\"]|x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|U[0-9a-fA-F]{8})",
					"name": "constant.character.escape.go.mod"
				},
				{
					"match": "\\\\[^0-7xuUabfnrtv\\'\"]",
					"name": "invalid.illegal.unknown-escape.go.mod"
				}
			]
		},
		"string_placeholder": {
			"patterns": [
				{
					"match": "%(\\[\\d+\\])?([\\+#\\-0\\x20]{,2}((\\d+|\\*)?(\\.?(\\d+|\\*|(\\[\\d+\\])\\*?)?(\\[\\d+\\])?)?))?[vT%tbcdoqxXUbeEfFgGsp]",
					"name": "constant.other.placeholder.go.mod"
				}
			]
		},
		"invalid": {
			"comment": "invalid",
			"match": ".*",
			"name": "invalid.illegal.unknown.go.mod"
		}
	}
}
