Slide 1

Slide 1 text

Visual Studio Codeޓ׵ͳ syntax highlighterͷ࣮૷ Θ͍Θ͍swiftc #9 omochimetaru 1

Slide 2

Slide 2 text

Syntax highlight ςΩετΛͦͷߏจʹԠͯ͡৭෇͚͢Δ →ߏจղੳ͕ඞཁ 2

Slide 3

Slide 3 text

ߏจͷղੳ ྫ͑͹SwiftίϯύΠϥ lib/Parse/Lexer.cpp lib/Parse/Parser.cpp ෳࡶͰ๲େͳϩδοΫ ϓϩάϥϛϯά͕ඞཁ 3

Slide 4

Slide 4 text

ςΩετΤσΟλ ͍Ζ͍ΖͳݴޠߏจʹରԠ ઃఆϑΝΠϧͷܗͰΤσΟλͷϦϏϧυແ͠ʹ௥ Ճ/࡟আ͕Մೳ 4

Slide 5

Slide 5 text

ۙ೥ͷτϨϯυ • TextMate • Sublime Text • Atom • Visual Studio Code ͜ΕΒશ͕ͯTextMateܗࣜΛ࠾༻ 5

Slide 6

Slide 6 text

TextMate Syntaxͷશମߏ଄ Syntax parser͕ςΩετΛτʔΫϯྻʹ෼ׂ͢Δ τʔΫϯʹ͸είʔϓׂ͕Γ౰ͯΒΕΔ ςʔϚγεςϜ͕είʔϓʹج͍ͮͯண৭͢Δ ͜ͷ࿩ͷςʔϚ͸લஈͷSyntax parser͚ͩ 6

Slide 7

Slide 7 text

Scopes 7

Slide 8

Slide 8 text

8

Slide 9

Slide 9 text

VSCodeͷSyntaxΠϯεϖΫ λ Command + Shift + P → Developer: Inspect TM Scopes ΍ͬͯΈΑ͏ 9

Slide 10

Slide 10 text

Scopes είʔϓ͸ೖΕࢠʹͳ͍ͬͯΔɺ͔ͭɺ ͦΕͧΕͷείʔϓ΋֊૚Խ͞Ε͍ͯΔ ॊೈͳண৭ઃఆ͕Ͱ͖Δ ΦʔτΠϯσϯτɺΞ΢τϥΠϯநग़ɺίʔυ ϑΥʔϧσΟϯάͳͲ͕࡞ΕΔ 10

Slide 11

Slide 11 text

ߏจͷೖΕࢠ 11

Slide 12

Slide 12 text

12

Slide 13

Slide 13 text

ߏจͷೖΕࢠ ͋Δݴޠͷߏจͷதʹɺ ผͷݴޠͷߏจΛຒΊࠐΊΔ 13

Slide 14

Slide 14 text

TextMate Syntaxͷղઆ جຊฤ ஫: Ҏ߱ͷ༻ޠ΍໋໊͸ΦϑΟγϟϧͳ΋ͷͱ ๻ͷউखͳ໋໊͕ࠞࡏ͢Δ (ެࣜจॻෆ଍ͷͨΊ) 14

Slide 15

Slide 15 text

؆୯ͳ࣮ྫ JSONͷߏจఆٛ https://github.com/Microsoft/vscode/blob/ master/extensions/json/syntaxes/ JSON.tmLanguage.json Ҏޙɺ͜ͷJSONϑΝΠϧΛదٓলུ͠ͳ͕ΒҾ ༻͢Δ 15

Slide 16

Slide 16 text

{ "name": "JSON (Javascript Next)", "scopeName": "source.json", "patterns": [ ], "repository": { "array": { }, "comments": { }, "constant": { }, "number": { }, "object": { }, "string": { }, "objectkey": { }, "stringcontent": { }, "value": { } } } 16

Slide 17

Slide 17 text

ߏจఆٛͷߏ଄ • ͋Δݴޠͷߏจͷ͜ͱΛGrammarͱݺͿ • Grammar͸RuleΛͨ͘͞Μ༻ҙͨ͠΋ͷ • Rule͸Repositoryʹ໊લͱڞʹ֨ೲ͞ΕΔ • Grammar͸ͦΕࣗ਎ϧʔτϨϕϧͷRuleͰ΋͋Δ • Rule͸RepositoryΛ࣋ͯΔ • scopeName͕GrammarͷϘτϜͷείʔϓʹͳΔ ͔͜͜Β͸(೴಺Ͱ)࣮૷͠ͳ͕Βฉ͍ͯ΄͍͠ 17

Slide 18

Slide 18 text

{ "patterns": [ { "include": "#value" } ], "repository": { "array": { }, "comments": { }, "constant": { }, "number": { }, "object": { }, "string": { }, "objectkey": { }, "stringcontent": { }, "value": { "patterns": [ { "include": "#constant" }, { "include": "#number" }, { "include": "#string" }, { "include": "#array" }, { "include": "#object" }, { "include": "#comments" } ] } } } 18

Slide 19

Slide 19 text

Include Rule • includeύϥϝʔλͰଞͷRuleΛࢀর͢Δϧʔ ϧ • #ͰRepositoryͷத͔ΒΛ୳ࡧ • Repository͔Βͷ୳ࡧ͸࠶ؼతʹ਌ϧʔϧ΁Ҡ ৡ͞ΕΔ 19

Slide 20

Slide 20 text

Hub Rule • patternsύϥϝʔλͰࢠϧʔϧୡΛ͚࣋ͭͩͷ ϧʔϧ • ແ৚݅Ͱ͋Γ͜ͷϧʔϧʹ͸҉໧ʹϚον͢Δ • GrammarͷϧʔτRule͸ίϨ • ઌͷྫͰ͸#value΋ίϨ 20

Slide 21

Slide 21 text

{ "repository": { "constant": { "match": "\\b(?:true|false|null)\\b", "name": "constant.language.json" }, "number": { "match": "(?x) # turn on extended mode\n" " -? # an optional minus\n" " (?:\n" " 0 # a zero\n" " | # ...or...\n" " [1-9] # a 1-9 character\n" " \\d* # followed by zero or more digits\n" " )\n" " (?:\n" " (?:\n" " \\. # a period\n" " \\d+ # followed by one or more digits\n" " )?\n" " (?:\n" " [eE] # an e character\n" " [+-]? # followed by an option +/-\n" " \\d+ # followed by one or more digits\n" " )? # make exponent optional\n" " )? # make decimal portion optional", "name": "constant.numeric.json" }, } } number.match͸දࣔͷ౎߹্෼ׂ͍ͯ͠·͕࣮͢ࡍʹ͸1ͭͷ௕͍จࣈྻͰ͋Δɻ 21

Slide 22

Slide 22 text

Match Rule • matchύϥϝʔλͷਖ਼نදݱΛςετͯ͠Ϛο ν͢Δϧʔϧ • ਖ਼نදݱํݴ͸OnigurumaΛ࠾༻ • Ϛονͨ͠ΒnameͰࢦఆͨ͠είʔϓΛ༩͑ Δ 22

Slide 23

Slide 23 text

JSONͷ਺஋ͷਖ਼نදݱ (?x) # turn on extended mode -? # an optional minus (?: 0 # a zero | # ...or... [1-9] # a 1-9 character \d* # followed by zero or more digits )\n (?: (?: \. # a period \d+ # followed by one or more digits )? (?: [eE] # an e character\n [+-]? # followed by an option +/- \d+ # followed by one or more digits )? # make exponent optional )? # make decimal portion optional ๯಄ͷ(?x)Ͱ֦ுه๏ϞʔυΛ։࢝ͯ͠վߦͱίϝϯτΛ༗ޮԽ 23

Slide 24

Slide 24 text

ਖ਼نදݱຊମ͸͜Ε https://www.json.org 24

Slide 25

Slide 25 text

ߦ୯Ґॲཧϧʔϧ TextMate SyntaxͰ͸ɺ͜ΕΒϚονϯάॲཧ͸ର ৅ͷςΩετʹରͯ͠ߦ୯ҐͰॲཧ͞ΕΔ ΋͠ɺվߦΛ·͍ͨͩਖ਼نදݱ͕͋Δ৔߹ɺશ͘ Ϛον͠ͳ͍ είʔϓׂ౰ʹΑΔτʔΫϯ෼ׂ͸ςΩετͷվ ߦ෦෼Ͱඞͣ෼அ͞ΕΔ 25

Slide 26

Slide 26 text

{ "repository": { "array": { "begin": "\\[", "end": "\\]", "name": "meta.structure.array.json", "patterns": [ { "include": "#value" }, { "match": ",", "name": "punctuation.separator.array.json" }, { "match": "[^\\s\\]]", "name": "invalid.illegal.expected-array-separator.json" } ] }, } } 26

Slide 27

Slide 27 text

BeginEnd Rule • beginύϥϝʔλͷਖ਼نදݱʹϚον͔ͯ͠Βɺ endύϥϝʔλͷਖ਼نදݱʹϚον͢Δ·Ͱͷൣ ғΛɺࣗ਎ʹϚον͢Δϧʔϧ • nameύϥϝʔλͷείʔϓΛࣗ਎ʹϚονͨ͠ൣ ғʹ༩͑Δ • beginͱendʹڬ·Εͨ෦෼ʹ͍ͭͯɺpatternsύ ϥϝʔλͷࢠϧʔϧୡΛద༻ͤ͞Δ ͜ΕʹΑΓೖΕࢠ͕࣮ݱͰ͖Δ 27

Slide 28

Slide 28 text

ParserͷϚονϯάಈ࡞ Parser͸ݱࡏͷϧʔϧͱݱࡏͷςΩετҐஔΛ࣋ͭ ݱࡏͷϧʔϧ͔ΒભҠ͠͏Δϧʔϧͷ͏ͪɺ࠷΋ ϚονϯάҐஔ͕ࠨʹདྷΔ΋ͷʹϚον͢Δ ࣮૷ͱͯ͠͸ɺෳ਺ͷਖ਼نදݱΛϚονͤͯ͞Έ ͯɺ݁Ռ͕࠷΋ࠨʹ͋ͬͨ΋ͷΛ࠾༻͢Δ੍ޚͱ ͳΔ ϚονϯάҐஔ͕ಉ͡ͳΒɺϚονϯάϦετͰ ઌʹ͋Δ΋ͷ͕༏ઌ͢Δ 28

Slide 29

Slide 29 text

JSONจ๏ͰͷϚονϯάϦ ετ rootͷ࣌ • \b(?:true|false|null)\b: root[0]→value[0]→constant.match • (?x)...: root[0]→value[1]→number.match • \": root[0]→value[2]→string.begin • \[": root[0]→value[3]→array.begin • \{: root[0]→value[4]→object.begin • /\*\*(?!/): root[0]→value[5]→comments[0] • /\*: root[0]→value[5]→comments[1] • (//).*$\n?: root[0]→value[5]→comments[2] 29

Slide 30

Slide 30 text

arrayͷ࣌ • \]: array.end • \b(?:true|false|null)\b: array[0]→value[0]→constant.match • (?x)...: array[0]→value[1]→number.match • \": array[0]→value[2]→string.begin • \[": array[0]→value[3]→array.begin • \{: array[0]→value[4]→object.begin • /\*\*(?!/): array[0]→value[5]→comments[0] • /\*: array[0]→value[5]→comments[1] • (//).*$\n?: array[0]→value[5]→comments[2] • ,: array[1].match • [^\s\]]: array[2].match 30

Slide 31

Slide 31 text

͜ͷϚονϯάϦετΛݟ͍ͯΔͱɺ࠶ؼԼ߱ߏ จղੳύʔαͷɺ࣍ͷτʔΫϯΛઌಡΈͯ͠ಛఆ ͷจ๏ϊʔυʹಥೖ͢Δॲཧͱɺಉ͡Α͏ͳߏ଄ ʹͳ͍ͬͯΔ গʑͷنଇͷσʔλʹΑͬͯɺߏจ͕දݱͰ͖ͯ ͍Δ͜ͱ͕Θ͔Δ 31

Slide 32

Slide 32 text

ߦ୯Ґ࣮ߦ ΤσΟλ͔Βར༻͢Δʹ͋ͨͬͯɺςΩετ͕ڊ େͳ৔߹ʹɺ෦෼มߋͷͨͼʹશจΛ࠶ॲཧͨ͠ ͘ͳ͍ɻਐḿ཰Λग़ͨ͠ΓɺඇมߋՕॴʹରͯ͠ աڈͷ݁Ռͷ࠶ར༻ΛࢼΈΔͨΊʹɺ͜ͷߏจղ ੳث͸ɺߦ୯ҐͰύʔεॲཧΛதஅɾ࠶։͕Մೳ ʹ࣮૷͍ͨ͠ɻ 32

Slide 33

Slide 33 text

࠶ؼͰ࣮૷͢ΔͷͰ͸ͳ͘ɺελοΫΛ࢖ͬͯ ϧʔϓͰ࣮૷͢Δɻ let parser = Parser(string: string, grammar: grammar) while !parser.isAtEnd { let tokens: [Token] = try parser.parseLine() } 33

Slide 34

Slide 34 text

ݴޠຒΊࠐΈ Include Ruleͷincludeύϥϝʔλ͸ผͷGrammar Λࢦఆ͢Δ͜ͱ͕Ͱ͖Δ • : ͜ͷείʔϓ໊ΛscopeNameʹ࣋ͭ GrammarͷϧʔτRuleΛࢀর 34

Slide 35

Slide 35 text

Objective-Cͷߏจ͸CͷߏจΛؚΉ { "name": "Objective-C", "scopeName": "source.objc", "patterns": [ { }, { }, { }, { }, ..., { "include": "source.c" }, { } ] } 35

Slide 36

Slide 36 text

HTMLͷߏจͷதͰPHPͷߏจΛݺͿ { "name": "PHP", "scopeName": "text.html.php", "repository": { "php-tag": { "patterns": [ { "begin": "<\\?(?i:php|=)?(?![^?]*\\?>)", "end": "(\\?)>", "name": "meta.embedded.block.php", "contentName": "source.php", "patterns": [ { "include": "source.php" } ] }, ] } } } 36

Slide 37

Slide 37 text

جຊฤ ·ͱΊ • Grammar, Repository, Rule • Hub, Include, Match, BeginEnd • ݱࡏͷRule • ϚονϦετͷચ͍ग़͠ • ࠷΋ࠨͰϚονͨ͠ਖ਼نදݱ • ߦ୯Ґॲཧ ࢓૊Έͷࠎ૊Έ͸͜Ε͚ͩ 37

Slide 38

Slide 38 text

TextMate Syntaxͷղઆ ൃలฤ 38

Slide 39

Slide 39 text

ൃలฤ ·ͩઆ໌͍ͯ͠ͳ͍ύϥϝʔλ΍ػೳ͕ͨ͘͞Μ ͋Δ 39

Slide 40

Slide 40 text

Ωϟϓνϟάϧʔϓείʔϓ 40

Slide 41

Slide 41 text

{ "captures": { "1": { "name": "support.function.construct.php" }, "2": { "name": "punctuation.definition.array.begin.php" }, "3": { "name": "punctuation.definition.array.end.php" } }, "match": "(array)(\\()(\\))", "name": "meta.array.empty.php" } 41

Slide 42

Slide 42 text

{ "array": { "begin": "\\[", "beginCaptures": { "0": { "name": "punctuation.definition.array.begin.json" } }, "end": "\\]", "endCaptures": { "0": { "name": "punctuation.definition.array.end.json" } }, "name": "meta.structure.array.json", "patterns": [ ... ] } } 42

Slide 43

Slide 43 text

Match Ruleͷmatch΍BeginEnd Ruleͷbeginͱ endͷਖ਼نදݱʹରͯ͠ɺΩϟϓνϟάϧʔϓʹ ࢦఆͨ͠είʔϓ໊Λ༩͑Δɻ0൪͸ਖ਼نදݱ Ϛονશମɻ BeginEnd RuleͰ΋captures͕ࢦఆͰ͖ɺ beginCapturesͱendCapturesͷ྆ํʹಉ͡஋Λ ༩͑Δɻ capturesͱbeginCapturesͷॏෳ࣌͸ޙऀ͕༏ ઌɻ 43

Slide 44

Slide 44 text

Ωϟϓνϟάϧʔϓ಺ͷࢠϧʔϧ 44

Slide 45

Slide 45 text

{ "begin": "(?x)\\s*\n" "\t\t\t\t\t ((?:(?:final|abstract|public|private|protected|static)\\s+)*)\n" "\t\t\t\t (function)\n" "\t\t\t\t (?:\\s+|(\\s*&\\s*))\n" "\t\t\t\t (?:\n" "\t\t\t\t (__(?:call|construct|destruct|get|set|isset|unset|tostring|" "clone|set_state|sleep|wakeup|autoload|invoke|callStatic))\n" "\t\t\t\t |([a-zA-Z0-9_]+)\n" "\t\t\t\t )\n" "\t\t\t\t \\s*\n" "\t\t\t\t (\\()", "beginCaptures": { "1": { "patterns": [ { "match": "final|abstract|public|private|protected|static", "name": "storage.modifier.php" } ] }, "2": { "name": "storage.type.function.php" }, "3": { "name": "storage.modifier.reference.php" }, "4": { "name": "support.function.magic.php" }, "5": { "name": "entity.name.function.php" }, "6": { "name": "punctuation.definition.parameters.begin.php" } } } 45

Slide 46

Slide 46 text

ΩϟϓνϟάϧʔϓͷதͰࢠϧʔϧΛ༩͑Δɻ 46

Slide 47

Slide 47 text

endύϥϝʔλͰͷޙํࢀর 47

Slide 48

Slide 48 text

{ "begin": "(?><<-(\\w+))", "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.ruby" } }, "comment": "heredoc with indented terminator", "end": "\\s*\\1$", "endCaptures": { "0": { "name": "punctuation.definition.string.end.ruby" } }, "name": "string.unquoted.heredoc.ruby", "patterns": [ { "include": "#heredoc" }, { "include": "#interpolated_ruby" }, { "include": "#escaped_char" } ] } 48

Slide 49

Slide 49 text

beginͷΩϟϓνϟάϧʔϓΛendͰޙํࢀরͰ͖ Δ print <

Slide 50

Slide 50 text

\G 50

Slide 51

Slide 51 text

{ "begin": "(^[ \\t]+)?(?=//)", "beginCaptures": { "1": { "name": "punctuation.whitespace.comment.leading.php" } }, "end": "(?!\\G)", "patterns": [ { "begin": "//", "beginCaptures": { "0": { "name": "punctuation.definition.comment.php" } }, "end": "\\n|(?=\\?>)", "name": "comment.line.double-slash.php" } ] } 51

Slide 52

Slide 52 text

Ұൠతͳਖ਼نදݱʹ͓͍ͯ͸ɺ܁Γฦ͠ϚονΛ ͢Δ৔߹ͷʮલճͷϚον຤ඌʯͳ͍͠͸ʮݕࡧ ։࢝Ґஔʯɻ begin΍matchͰ࢖ΘΕͨ৔߹͸ʮݕࡧ։࢝Ґ ஔʯɻendͰ࢖ΘΕͨ৔߹͸ʮbeginͷϚον຤ ඌʯɻ ߦ൪߸Λߟྀͯ͠ਖ਼نදݱΤϯδϯʹ\GͷҐஔΛ ༩͑Δɻ 52

Slide 53

Slide 53 text

contentName 53

Slide 54

Slide 54 text

{ "string-double-quoted": { "begin": "\"", "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.php" } }, "contentName": "meta.string-contents.quoted.double.php", "end": "\"", "endCaptures": { "0": { "name": "punctuation.definition.string.end.php" } }, "name": "string.quoted.double.php", "patterns": [ { "include": "#interpolation" } ] } 54

Slide 55

Slide 55 text

contentName͸beginͱendʹڬ·Εͨ෦෼ʹε ίʔϓΛ༩͑Δɻ name͸beginͱendΛؚΉɻ 55

Slide 56

Slide 56 text

applyEndPatternLast 56

Slide 57

Slide 57 text

{ "begin": "\\?", "beginCaptures": { "0": { "name": "keyword.operator.ternary.c" } }, "end": ":", "applyEndPatternLast": true, "endCaptures": { "0": { "name": "keyword.operator.ternary.c" } }, "patterns": [ { "include": "#access" }, { "include": "#libc" }, { "include": "#c_function_call" }, { "include": "$base" } ] } 57

Slide 58

Slide 58 text

beginʹϚονͯ͠BeginEnd Ruleͷ಺෦ʹډΔ ͱ͖ɺ௨ৗ͸endϧʔϧ͸࠷ߴ༏ઌ౓͕ͩɺ applyEndPatternLast͕ࢦఆ͞Ε͍ͯΔͱ͖͸end ϧʔϧ͕࠷௿༏ઌ౓ʹͳΔɻ 58

Slide 59

Slide 59 text

$self 59

Slide 60

Slide 60 text

{ "begin": "\\b(require|require_relative|gem)\\b", "captures": { "1": { "name": "keyword.other.special-method.ruby" } }, "end": "$|(?=#|\\})", "name": "meta.require.ruby", "patterns": [ { "include": "$self" } ] } 60

Slide 61

Slide 61 text

ͦͷRule͕ఆٛ͞ΕͨGrammarͷϧʔτRuleΛ ࢀর͢Δɻ 61

Slide 62

Slide 62 text

$base 62

Slide 63

Slide 63 text

{ "parens": { "begin": "\\(", "beginCaptures": { "0": { "name": "punctuation.section.parens.begin.c" } }, "end": "\\)", "endCaptures": { "0": { "name": "punctuation.section.parens.end.c" } }, "name": "meta.parens.c", "patterns": [ { "include": "$base" } ] } } 63

Slide 64

Slide 64 text

ݱࡏͷςΩετࣗମͷݴޠͷGrammarͷϧʔτ RuleΛࢀর͢Δɻ௨ৗ͸$selfͱಉ͡ҙຯ͕ͩɺ ݴޠຒΊࠐΈ͕ൃੜ͍ͯ͠Δ৔߹ʹ͸ɺϧʔτͷ ݴޠΛࢀর͢Δ఺͕ҟͳΔɻ Cݴޠ͸C++΍Objective-C͔ΒຒΊࠐ·Εͯ࢖Θ ΕΔͨΊɺࣗݾ࠶ؼ͢Δͱ͜ΖͰ$baseΛ࢖ͬͯ ͍Δɻ 64

Slide 65

Slide 65 text

# 65

Slide 66

Slide 66 text

{ "begin": "@\"", "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.objc" } }, "end": "\"", "endCaptures": { "0": { "name": "punctuation.definition.string.end.objc" } }, "name": "string.quoted.double.objc", "patterns": [ { "include": "source.c#string_escaped_char" }, { "match": "(?x)%\n" "\t\t\t\t\t\t(\\d+\\$)? # field (argument #)\n" "\t\t\t\t\t\t[#0\\- +']* # flags\n" "\t\t\t\t\t\t((-?\\d+)|\\*(-?\\d+\\$)?)? # minimum field width\n" "\t\t\t\t\t\t(\\.((-?\\d+)|\\*(-?\\d+\\$)?)?)? # precision\n" "\t\t\t\t\t\t[@] # conversion type\n" "\t\t\t\t\t", "name": "constant.other.placeholder.objc" }, { "include": "source.c#string_placeholder" } ] } 66

Slide 67

Slide 67 text

ผݴޠࢀরͱϦϙδτϦࢀরΛͻͱ·ͱΊʹॻ͚ Δɻ ྫͰ͸ɺObjective-Cจࣈྻͷ಺෦ͰCͷจ๏Λࢀ র͍ͯ͠Δɻ 67

Slide 68

Slide 68 text

disabled 68

Slide 69

Slide 69 text

{ "regular_expressions": { "comment": "Changed disabled to 1 to turn off syntax highlighting in “r” strings.", "disabled": 0, "patterns": [ { "include": "source.regexp.python" } ] } } 69

Slide 70

Slide 70 text

disabled͕ઃఆ͞Ε͍ͯΔRule͸ॻ͔Ε͍ͯͳ͍ ΋ͷͱͯ͠ѻ͏ɻ 70

Slide 71

Slide 71 text

ఀࢭอূ 71

Slide 72

Slide 72 text

·͍ͣϧʔϧΛॻ͘ͱςΩετͷॲཧҐஔ͕ਐ· ͳ͘ͳΓɺύʔα͕ແݶϧʔϓͯ͠͠·͏ͷͰɺ ͦ͏ͨ͠ύλʔϯΛݕग़ͯ͠ఀࢭ͢ΔϩδοΫ͕ ඞཁɻ 72

Slide 73

Slide 73 text

Injection 73

Slide 74

Slide 74 text

{ "scopeName": "todo-comment.injection", "injectionSelector": "L:comment.line.double-slash", "patterns": [ { "include": "#todo-keyword" } ], "repository": { "todo-keyword": { "match": "TODO", "name": "keyword.todo" } } } 74

Slide 75

Slide 75 text

{ "injectionSelector": "text, string, comment", "name": "Hyperlink", "patterns": [ { "match": "(?x)\n" "\t\t\t\t( (https?|s?ftp|ftps|file|smb|afp|nfs|(x-)?man(-page)?|gopher|txmt|issue)://|mailto:)\n" "\t\t\t\t[-:@a-zA-Z0-9_.,~%+/?=]+(?

Slide 76

Slide 76 text

͋Δߏจఆٛʹରͯ͠ɺผͷߏจΛૠೖ͢Δػ ೳɻૠೖҐஔΛinjectionSelectorͰࢦఆ͢Δɻ ઌͷྫͰ͸ɺطଘจ๏ͷίϝϯτ෦෼ͷTODOΛ ϋΠϥΠτͨ͠ΓɺจࣈྻϦςϥϧ΍ίϝϯτத ͷURLΛϋΠϥΠτ͍ͯ͠Δɻ 76

Slide 77

Slide 77 text

{ "injections": { "text.html.php - (meta.embedded | meta.tag), " "L:text.html.php meta.tag, " "L:source.js.embedded.html": { "patterns": [ { }, { }, { } ] } }, "name": "PHP", "patterns": [ { "include": "text.html.basic" } ], "repository": { } } 77

Slide 78

Slide 78 text

Grammarࣗ਎͕injectionΛ࣋ͭ͜ͱ΋Ͱ͖Δɻ͜ ͷGrammarͷॲཧதʹ͓͍ͯɺ͜ͷinjection͕ద ٓૠೖ͞ΕΔɻ 78

Slide 79

Slide 79 text

BeginWhile Rule ௐࠪத 79

Slide 80

Slide 80 text

Embedded Language ௐࠪத 80

Slide 81

Slide 81 text

ൃలฤ ·ͱΊ ͨ͘͞Μ͋Δ͔ΒҰ࣮ͭͣͭ૷͠Α͏ 81

Slide 82

Slide 82 text

ࢲͷ࣮૷ https://github.com/omochi/TMSyntax SwiftͰ࣮૷ɻ ࠓ೔ͷ࿩Λ΄΅࣮૷ɻ 82

Slide 83

Slide 83 text

ਖ਼نදݱͷͨΊʹOnigmoͷSwiftϒϦοδΛ࡞ ੒ɻ https://github.com/omochi/Onigmo-swift-build 83

Slide 84

Slide 84 text

Onigmoͷ࣮૷ʹෆ౎߹͕͋ΓɺUTF-8͕31bit· Ͱαϙʔτ͢ΔΑ͏ʹύονΛఏग़ https://github.com/k-takata/Onigmo/pull/111 https://qiita.com/omochimetaru/items/ 3dd5a3aa5ff476f47e79 84

Slide 85

Slide 85 text

σόοΨϏϦςΟͷ޲্ΛૂͬͯJSONύʔαΛ ࣗ࡞ TMSyntaxͰJSONͷߏจఆٛΛಡΈࠐΜͰ͍Δ ࣌ɺ JSONΛύʔε͢ΔͨΊͷߏจఆ͕ٛॻ͔Εͨ JSONΛύʔε͢ΔͨΊͷࣗ࡞ͷJSONύʔαʔ͕ ૸͍ͬͯΔ ! 85

Slide 86

Slide 86 text

σίʔυͨ͠ܕʹߦ൪߸͕͍ͭͯ͘Δɻ ίϝϯτ͕ॻ͚Δɻ https://github.com/omochi/FineJSON https://github.com/omochi/RichJSONParser 86

Slide 87

Slide 87 text

ύʔα͸Foundation.NSJSONSerializationΑΓ 2.5ഒ஗͍ɻ ϑΥʔϥϜʹॻ͖ࠐΜ͚ͩͲϨε͔ͭͣ https://forums.swift.org/t/how-to-write-fast-json- parser-in-swift/20281 87

Slide 88

Slide 88 text

Ϣχοτςετ VSCodeͷςετεΠʔτΛม׵ͯ͠औΓࠐΜͰ ςετɻ First Mate Test Suite શ46݅ʹ߹֨ɻ First Mate͸AtomͷTextMate Syntax࣮૷Ͱɺ VSCode͸ͦͷςετεΠʔτΛม׵ͯ͠औΓࠐ ΜͰ͍Δɻ 88

Slide 89

Slide 89 text

ల๬ iPad޲͚ͷ։ൃऀ޲͚ΤσΟλͱ͔࡞ΕΔ͔΋ʁ 89