{ "name": "diff", "rules": { "source": { "type": "SEQ", "members": [ { "type": "REPEAT", "content": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "block" }, { "type": "SEQ", "members": [ { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "_line" }, { "type": "BLANK" } ] }, { "type": "PATTERN", "value": "\\r?\\n" } ] } ] } }, { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "_line" }, { "type": "BLANK" } ] } ] }, "_line": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "file_change" }, { "type": "SYMBOL", "name": "binary_change" }, { "type": "SYMBOL", "name": "index" }, { "type": "SYMBOL", "name": "similarity" }, { "type": "SYMBOL", "name": "old_file" }, { "type": "SYMBOL", "name": "new_file" }, { "type": "SYMBOL", "name": "location" }, { "type": "SYMBOL", "name": "addition" }, { "type": "SYMBOL", "name": "deletion" }, { "type": "SYMBOL", "name": "context" }, { "type": "SYMBOL", "name": "comment" } ] }, "block": { "type": "PREC_RIGHT", "value": 0, "content": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "command" }, { "type": "PATTERN", "value": "\\r?\\n" }, { "type": "REPEAT", "content": { "type": "SEQ", "members": [ { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "file_change" }, { "type": "SYMBOL", "name": "binary_change" }, { "type": "SYMBOL", "name": "index" }, { "type": "SYMBOL", "name": "similarity" } ] }, { "type": "PATTERN", "value": "\\r?\\n" } ] } }, { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "old_file" }, { "type": "PATTERN", "value": "\\r?\\n" }, { "type": "SYMBOL", "name": "new_file" }, { "type": "PATTERN", "value": "\\r?\\n" }, { "type": "SYMBOL", "name": "hunks" } ] }, { "type": "BLANK" } ] } ] } }, "hunks": { "type": "PREC_RIGHT", "value": 0, "content": { "type": "REPEAT1", "content": { "type": "SYMBOL", "name": "hunk" } } }, "hunk": { "type": "PREC_RIGHT", "value": 0, "content": { "type": "SEQ", "members": [ { "type": "FIELD", "name": "location", "content": { "type": "SYMBOL", "name": "location" } }, { "type": "PATTERN", "value": "\\r?\\n" }, { "type": "CHOICE", "members": [ { "type": "FIELD", "name": "changes", "content": { "type": "SYMBOL", "name": "changes" } }, { "type": "BLANK" } ] } ] } }, "changes": { "type": "PREC_RIGHT", "value": 0, "content": { "type": "REPEAT1", "content": { "type": "SEQ", "members": [ { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "addition" }, { "type": "SYMBOL", "name": "deletion" }, { "type": "SYMBOL", "name": "context" } ] }, { "type": "PREC_RIGHT", "value": 0, "content": { "type": "REPEAT1", "content": { "type": "PATTERN", "value": "\\r?\\n" } } } ] } } }, "command": { "type": "SEQ", "members": [ { "type": "IMMEDIATE_TOKEN", "content": { "type": "STRING", "value": "diff" } }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "[-\\w]+" }, "named": true, "value": "argument" }, { "type": "SYMBOL", "name": "filename" } ] }, "file_change": { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "CHOICE", "members": [ { "type": "STRING", "value": "new" }, { "type": "STRING", "value": "deleted" } ] }, { "type": "STRING", "value": "file" }, { "type": "STRING", "value": "mode" }, { "type": "SYMBOL", "name": "mode" } ] }, { "type": "SEQ", "members": [ { "type": "CHOICE", "members": [ { "type": "STRING", "value": "new" }, { "type": "STRING", "value": "old" } ] }, { "type": "STRING", "value": "mode" }, { "type": "SYMBOL", "name": "mode" } ] }, { "type": "SEQ", "members": [ { "type": "STRING", "value": "rename" }, { "type": "CHOICE", "members": [ { "type": "STRING", "value": "from" }, { "type": "STRING", "value": "to" } ] }, { "type": "SYMBOL", "name": "filename" } ] } ] }, "binary_change": { "type": "SEQ", "members": [ { "type": "IMMEDIATE_TOKEN", "content": { "type": "STRING", "value": "Binary" } }, { "type": "STRING", "value": "files" }, { "type": "SYMBOL", "name": "filename" }, { "type": "STRING", "value": "and" }, { "type": "SYMBOL", "name": "filename" }, { "type": "STRING", "value": "differ" } ] }, "index": { "type": "SEQ", "members": [ { "type": "IMMEDIATE_TOKEN", "content": { "type": "STRING", "value": "index" } }, { "type": "SYMBOL", "name": "commit" }, { "type": "STRING", "value": ".." }, { "type": "SYMBOL", "name": "commit" }, { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "mode" }, { "type": "BLANK" } ] } ] }, "similarity": { "type": "SEQ", "members": [ { "type": "IMMEDIATE_TOKEN", "content": { "type": "STRING", "value": "similarity" } }, { "type": "STRING", "value": "index" }, { "type": "ALIAS", "content": { "type": "PATTERN", "value": "\\d+" }, "named": true, "value": "score" }, { "type": "STRING", "value": "%" } ] }, "old_file": { "type": "SEQ", "members": [ { "type": "IMMEDIATE_TOKEN", "content": { "type": "STRING", "value": "---" } }, { "type": "SYMBOL", "name": "filename" } ] }, "new_file": { "type": "SEQ", "members": [ { "type": "IMMEDIATE_TOKEN", "content": { "type": "STRING", "value": "+++" } }, { "type": "SYMBOL", "name": "filename" } ] }, "location": { "type": "SEQ", "members": [ { "type": "IMMEDIATE_TOKEN", "content": { "type": "STRING", "value": "@@" } }, { "type": "SYMBOL", "name": "linerange" }, { "type": "SYMBOL", "name": "linerange" }, { "type": "STRING", "value": "@@" }, { "type": "CHOICE", "members": [ { "type": "PATTERN", "value": "[^\\r\\n]+" }, { "type": "BLANK" } ] } ] }, "addition": { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "IMMEDIATE_TOKEN", "content": { "type": "STRING", "value": "+" } }, { "type": "CHOICE", "members": [ { "type": "PATTERN", "value": "[^\\r\\n]+" }, { "type": "BLANK" } ] } ] }, { "type": "SEQ", "members": [ { "type": "IMMEDIATE_TOKEN", "content": { "type": "STRING", "value": "++" } }, { "type": "CHOICE", "members": [ { "type": "PATTERN", "value": "[^\\r\\n]+" }, { "type": "BLANK" } ] } ] }, { "type": "SEQ", "members": [ { "type": "IMMEDIATE_TOKEN", "content": { "type": "STRING", "value": "+++" } } ] }, { "type": "SEQ", "members": [ { "type": "IMMEDIATE_TOKEN", "content": { "type": "STRING", "value": "++++" } }, { "type": "CHOICE", "members": [ { "type": "PATTERN", "value": "[^\\r\\n]+" }, { "type": "BLANK" } ] } ] } ] }, "deletion": { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "IMMEDIATE_TOKEN", "content": { "type": "STRING", "value": "-" } }, { "type": "CHOICE", "members": [ { "type": "PATTERN", "value": "[^\\r\\n]+" }, { "type": "BLANK" } ] } ] }, { "type": "SEQ", "members": [ { "type": "IMMEDIATE_TOKEN", "content": { "type": "STRING", "value": "--" } }, { "type": "CHOICE", "members": [ { "type": "PATTERN", "value": "[^\\r\\n]+" }, { "type": "BLANK" } ] } ] }, { "type": "SEQ", "members": [ { "type": "IMMEDIATE_TOKEN", "content": { "type": "STRING", "value": "---" } } ] }, { "type": "SEQ", "members": [ { "type": "IMMEDIATE_TOKEN", "content": { "type": "STRING", "value": "----" } }, { "type": "CHOICE", "members": [ { "type": "PATTERN", "value": "[^\\r\\n]+" }, { "type": "BLANK" } ] } ] } ] }, "context": { "type": "TOKEN", "content": { "type": "PREC", "value": -1, "content": { "type": "PATTERN", "value": "[^\\r\\n]+" } } }, "comment": { "type": "SEQ", "members": [ { "type": "IMMEDIATE_TOKEN", "content": { "type": "STRING", "value": "#" } }, { "type": "CHOICE", "members": [ { "type": "PATTERN", "value": "[^\\r\\n]+" }, { "type": "BLANK" } ] } ] }, "linerange": { "type": "PATTERN", "value": "[-\\+]\\d+(,\\d+)?" }, "filename": { "type": "REPEAT1", "content": { "type": "PATTERN", "value": "\\S+" } }, "commit": { "type": "PATTERN", "value": "[a-f0-9]{7,40}" }, "mode": { "type": "PATTERN", "value": "\\d+" } }, "extras": [ { "type": "PATTERN", "value": "[\\t\\f\\v ]+" } ], "conflicts": [], "precedences": [], "externals": [], "inline": [], "supertypes": [] }