|
| 1 | +Importing into another repository with git-subtree_ |
| 2 | +=================================================== |
| 3 | + |
| 4 | +.. _git-subtree: https://github.com/apenwarr/git-subtree |
| 5 | + |
| 6 | +To import the first time to a ``./css-parsing-tests`` sub-directory, |
| 7 | +run this from the top-level of a git repository:: |
| 8 | + |
| 9 | + git subtree add -P css-parsing-tests https://github.com/SimonSapin/css-parsing-tests.git master |
| 10 | + |
| 11 | +Later, to merge changes made in the upstream repository, run:: |
| 12 | + |
| 13 | + git subtree pull -P css-parsing-tests https://github.com/SimonSapin/css-parsing-tests.git master |
| 14 | + |
| 15 | + |
| 16 | +Result representation |
| 17 | +===================== |
| 18 | + |
| 19 | +AST nodes (the results of parsing) are represented in JSON as follow. |
| 20 | +This representation was chosen to be compact |
| 21 | +(and thus less annoying to write by hand) |
| 22 | +while staying unambiguous. |
| 23 | +For example, the difference between @import and \@import is not lost: |
| 24 | +they are represented as ``["at-keyword", "import"]`` and ``["ident", "@import"]``, |
| 25 | +respectively. |
| 26 | + |
| 27 | + |
| 28 | +Component values |
| 29 | +---------------- |
| 30 | + |
| 31 | +<ident> |
| 32 | + Array of length 2: the string ``"ident"``, and the value as a string. |
| 33 | + |
| 34 | +<at-keyword> |
| 35 | + Array of length 2: the string ``"at-keyword"``, and the value as a string. |
| 36 | + |
| 37 | +<hash> |
| 38 | + Array of length 3: the string ``"hash"``, the value as a string, |
| 39 | + and the type as the string ``"id"`` or ``"unrestricted"``. |
| 40 | + |
| 41 | +<string> |
| 42 | + Array of length 2: the string ``"string"``, and the value as a string. |
| 43 | + |
| 44 | +<bad-string> |
| 45 | + Array of length 1: the string ``"bad-string"``. |
| 46 | + |
| 47 | +<url> |
| 48 | + Array of length 2: the string ``"url"``, and the value as a string. |
| 49 | + |
| 50 | +<bad-url> |
| 51 | + Array of length 1: the string ``"bad-url"``. |
| 52 | + |
| 53 | +<delim> |
| 54 | + The value as a one-character string. |
| 55 | + |
| 56 | +<number> |
| 57 | + Array of length 4: the string ``"number"``, the representation as a string, |
| 58 | + the value as a number, and the type as the string ``"integer"`` or ``"number"``. |
| 59 | + |
| 60 | +<percentage> |
| 61 | + Array of length 4: the string ``"percentage"``, the representation as a string, |
| 62 | + the value as a number, and the type as the string ``"integer"`` or ``"number"``. |
| 63 | + |
| 64 | +<dimension> |
| 65 | + Array of length 4: the string ``"dimension"``, the representation as a string, |
| 66 | + the value as a number, the type as the string ``"integer"`` or ``"number"``, |
| 67 | + and the unit as a string. |
| 68 | + |
| 69 | +<unicode-range> |
| 70 | + Array of length 2: the string ``"unicode-range"``, and the range as either |
| 71 | + null for the empty range, or an array of two numbers. |
| 72 | + |
| 73 | +<include-match> |
| 74 | + The string ``"~="``. |
| 75 | + |
| 76 | +<dash-match> |
| 77 | + The string ``"|="``. |
| 78 | + |
| 79 | +<prefix-match> |
| 80 | + The string ``"^="``. |
| 81 | + |
| 82 | +<suffix-match> |
| 83 | + The string ``"$="``. |
| 84 | + |
| 85 | +<substring-match> |
| 86 | + The string ``"*="``. |
| 87 | + |
| 88 | +<column> |
| 89 | + The string ``"||"``. |
| 90 | + |
| 91 | +<whitespace> |
| 92 | + The string ``" "`` (a single space.) |
| 93 | + |
| 94 | +<CDO> |
| 95 | + The string ``"<!--"``. |
| 96 | + |
| 97 | +<CDC> |
| 98 | + The string ``"-->"``. |
| 99 | + |
| 100 | +<colon> |
| 101 | + The string ``":"``. |
| 102 | + |
| 103 | +<semicolon> |
| 104 | + The string ``";"``. |
| 105 | + |
| 106 | +<comma> |
| 107 | + The string ``","``. |
| 108 | + |
| 109 | +{} block |
| 110 | + An array of length N+1: the string ``"{}"`` |
| 111 | + followed by the N component values of the block’s value. |
| 112 | + |
| 113 | +[] block |
| 114 | + An array of length N+1: the string ``"[]"`` |
| 115 | + followed by the N component values of the block’s value. |
| 116 | + |
| 117 | +() block |
| 118 | + An array of length N+1: the string ``"()"`` |
| 119 | + followed by the N component values of the block’s value. |
| 120 | + |
| 121 | +Function |
| 122 | + An array of length N+2: the string ``"function"`` |
| 123 | + and the name of the function as a string |
| 124 | + followed by the N component values of the function’s value. |
| 125 | + |
| 126 | + |
| 127 | +Other nodes |
| 128 | +----------- |
| 129 | + |
| 130 | +Declaration |
| 131 | + An array of length 4: the string ``"declaration"``, the name as a string, |
| 132 | + the value as a nested array of component values, |
| 133 | + and a the important flag as a boolean. |
| 134 | + |
| 135 | +At-rule |
| 136 | + An array of length 4: the string ``"at-rule"``, |
| 137 | + the name (value of the at-keyword) as a string, |
| 138 | + the prelude as a nested array of component values, |
| 139 | + and the optional block as a nested array of component value, or null. |
| 140 | + |
| 141 | +Qualified rule |
| 142 | + An array of length 3: the string ``"qualified rule"``, |
| 143 | + the prelude as a nested array of component values, |
| 144 | + and the block as a nested array of component value. |
0 commit comments