dockerfile.jsf (3130B)
1 # Barebones Dockerfile syntax for JOE. Doesn't handle more sophisticated sh syntax. 2 3 =Idle 4 =Command +Statement +Keyword 5 =Comment 6 =Constant 7 =String +Constant 8 =Ident 9 =Escape 10 =Brace 11 =StringEscape +Escape 12 =Variable +DefinedIdent 13 14 # Start of line is special 15 :start Idle 16 * idle 17 " \t" start 18 "#" comment noeat 19 "A-Za-z" command buffer noeat 20 "\n" start 21 22 # Comments between commands 23 :comment Comment comment 24 * comment 25 "BFHNTX" comment noeat call=comment_todo.comment_todo() 26 "\n" start 27 28 # Comments in the middle of a command 29 :comment_idle Comment comment 30 * comment_idle 31 "\n" idle 32 33 # Start of line in the middle of "idle" mode (skips command recognition in case a comment 34 # comes in the middle of a RUN) 35 :start_idle Idle 36 * idle noeat 37 "#" comment_idle recolor=-1 38 39 # Generic middle-of-a-command 40 :idle Idle 41 * idle 42 "$" idle recolor=-1 call=.variable() 43 "\n" start 44 "\\" escape recolor=-1 45 46 :escape Escape 47 * idle recolor=-2 noeat 48 "\\\"" idle 49 "\r" escape 50 "\n" start_idle 51 52 :command Idle 53 * idle noeat istrings 54 "FROM" from 55 "MAINTAINER" string_command 56 "RUN" list_command 57 "CMD" list_command 58 "LABEL" label 59 "EXPOSE" generic_command 60 "ENV" generic_command 61 "ADD" list_command 62 "COPY" list_command 63 "ENTRYPOINT" list_command 64 "VOLUME" list_command 65 "USER" string_command 66 "WORKDIR" string_command 67 "ARG" generic_command 68 "ONBUILD" generic_command 69 "STOPSIGNAL" generic_command 70 done 71 "a-zA-Z" command 72 73 # EXPOSE, ENV, ARG, ONBUILD, STOPSIGNAL 74 :generic_command Command 75 * idle 76 77 # MAINTAINER, USER, WORKDIR 78 :string_command Command 79 * string_command_data 80 81 :string_command_data Constant 82 * string_command_data 83 "$" string_command_data recolor=-1 call=.variable() 84 "\n" start 85 86 # FROM 87 :from Command 88 * from_image noeat 89 90 :from_image Constant 91 * from_image 92 ":@" from_tag noeat 93 "\n" start 94 95 :from_tag Idle 96 * from_tag 97 "\n" start 98 99 # RUN, CMD, ADD, COPY, ENTRYPOINT, VOLUME 100 :list_command Command 101 * idle noeat 102 " \t" list_command 103 "[" array noeat 104 "\n" start 105 106 :array Idle 107 * array 108 "[]" bracket noeat 109 "\"'" array recolor=-1 call=.string() save_c 110 "\n" start 111 112 :comma Idle 113 * array noeat 114 115 :bracket Brace 116 "]" idle 117 "[" array 118 119 # LABEL 120 :label Command 121 * label_key 122 "\n" start 123 124 :label_key Variable 125 * label_key 126 "=" label_value noeat 127 "\n" start 128 129 :label_value Constant 130 * label_value 131 "\"" label_value recolor=-1 call=.string() save_c 132 "\n" start 133 134 .subr variable 135 136 :variable Variable 137 * variable recolor=-2 return noeat 138 "A-Za-z_" variable_name 139 "{" variable_long 140 141 :variable_name Variable 142 * variable_name return noeat 143 "A-Za-z0-9_" variable_name 144 145 :variable_long Variable 146 * variable_long 147 & variable return noeat 148 "\n" variable return noeat 149 "}" variable return 150 ":" variable_after 151 152 :variable_after Idle 153 * variable_after 154 & variable_after return noeat 155 "}" variable_long noeat 156 157 .end 158 159 .subr string 160 161 :string String string 162 * string 163 & string return 164 "\n" string return noeat 165 "\\" string_escape recolor=-1 166 "$" string recolor=-1 call=.variable() 167 168 :string_escape StringEscape string 169 * string 170 171 .end