Created
September 20, 2016 12:17
-
-
Save subzey/ea6c879b98c7fd644e2da21289b44848 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Define has_cats as true | |
| has_cats: [x] | |
| # Same for has_dogs | |
| has_dogs: [x] | |
| # Define has_dinosaurs as false | |
| has_dinosaurs: [_] | |
| # Some expressions | |
| nobody: !(use_cats | use_dogs) | |
| nodejs_cats: has_cats & has_nodejs | |
| # Mark experimental as unset | |
| # To be defined in the runtime, for example, | |
| # with Feature.set('expresimental', true) | |
| experimental: [?] | |
| # Expressions with uset values are allowed | |
| expreimental_cats: has_cats & experimental | |
| # Line doesn't end if the paren is opened | |
| unstable_dogs: ( | |
| [?] | |
| & has_dogs | |
| & !expreimental_cats | |
| ) | |
| # Import all rules from ./base.features | |
| # All relative filenames are resolved from _this_ file, | |
| # not curdir | |
| *: [from ./base.features] | |
| # Import all rules from ./features.json, property "prod" | |
| *: [json ./features.json prod] | |
| # is_prod is true if env.ENV matches /^prod/ | |
| is_prod: [env ENV ^prod r] | |
| # execute "which node" and return true if return code is 0 | |
| # (no error) | |
| has_nodejs: [shell which node] | |
| # Notice that nodejs_cats refers to has_nodejs, but | |
| # has_nodejs is defined after that. | |
| # That's perfectly fine. | |
| # Operators | |
| # & | ! ( ) | |
| # Functions | |
| # [x] - true | |
| # [_] - false | |
| # [?] - is defined later | |
| # [from str_filename] - import rules from file | |
| # [json str_filename str_property? str_property? ...] - import rules (true/false/null) from json file | |
| # [env str_varname str_matches str_flags?] - true if env variable matches | |
| # str_flags: one of "", "r", "i", "ri" | |
| # r stands for RegExp | |
| # i stands for IgnoreCase | |
| # Formal function syntax: | |
| # function: "[" fn_name? (whitespace string)* "]" | |
| # whitespace: <unicode whitespace range> | |
| # fn_name: a-z* | "_" | "?" | |
| # string: quoted_string | unquoted_string | |
| # quoted_string: '"' quoted_string_char* '"' | "'" quoted_string_char* "'" | |
| # quoted_string_char: <anything except whitespace and "\"> | escape-seq | |
| # escape-seq: "\\" | "\r" | "\n" | "\t" | unicode-escape | |
| # unicode-escape: "\u" escape_hex escape_hex escape_hex escape_hex | |
| # escape-digit: 0 - 9 | a - f | A - F | |
| # unquoted_string: unquoted_string_char+ | |
| # unquoted_string_char: <anything expect whitespace, "\", "[", "]"> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment