Skip to content

Commit

Permalink
20670: Removed .nan and .nas keywords, MAJOR (#16)
Browse files Browse the repository at this point in the history
- Removed .nas and .nan keywords due to removal in Amalgam 54.0.0
- Updated snippets
  • Loading branch information
fulpm authored Jun 26, 2024
1 parent c0e8f01 commit c86d565
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 27 deletions.
32 changes: 16 additions & 16 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "amalgam-lang",
"version": "1.3.1",
"version": "2.0.0",
"type": "commonjs",
"publisher": "howso",
"displayName": "Amalgam Language",
Expand Down
14 changes: 7 additions & 7 deletions snippets/amalgam.snippets.json
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@
"body": [
"(generalized_distance"
],
"description": "generalized_distance list|assoc|number weights list|assoc distance_types list|assoc attributes list|assoc|number deviations number p_value list|assoc|* vector1 [list|assoc|* vector2] [list value_names] [bool surprisal_space] || Computes the generalized norm between vector1 and vector2 (or an equivalent zero vector if unspecified) with parameter specified by the p_value (2 being Euclidian distance), using the numerical distance or edit distance as appropriate. The parameter value_names, if specified as a list of the names of the values, will transform via unzipping any assoc into a list for the respective parameter in the order of the value_names, or if a number will use the number repeatedly for every element. weights is a list of dimension weights to use for the query, each value mapping to its respective element in the vectors. If weights is null, then it will assume that the weights are 1 and additionally will ignore null values for the vectors instead of treating them as unknown differences. The parameter distance_types is either a list strings or an assoc of strings indicating the type of distance for each feature. Allowed values are \"nominal_numeric\", \"nominal_string\", \"nominal_code\", \"continuous_numeric\", \"continuous_numeric_cyclic\", \"continuous_string\", and \"continuous_code\". Nominals evaluate whether the two values are the same and continuous evaluates the difference between the two values. The numeric, string, or code modifier specifies how the difference is measured, and cyclic means it is a difference that wraps around. \nFor attributes, the particular distance_types specifies what particular attributes are expected. For a nominal distance_type, a number indicates the nominal count, whereas null will infer from the values given. Cyclic requires a single value, which is the upper bound of the difference for the cycle range (e.g., if the value is 360, then the supremum difference between two values will be 360, leading 1 and 359 to have a difference of 2).\n Deviations are used during distance calculation to specify uncertainty per-element, the minimum difference between two values prior to exponentiation. Specifying null as a deviation is equivalent to setting each deviation to 0. Each deviation for each feature can be a single value or a list. If it is a single value, that value is used as the deviation and differences and deviations for null values will automatically computed from the data based on the maximum difference. If a deviation is provided as a list, then the first value is the deviation, the second value is the difference to use when one of the values being compared is null, and the third value is the difference to use when both of the values are null. If the third value is omitted, it will use the second value for both. If both of the null values are omitted, then it will compute the maximum difference and use that for both. For nominal types, the value for each feature can be a numeric deviation, an assoc, or a list. If the value is an assoc it specifies deviation information, where each key of the assoc is the nominal value, and each value of the assoc can be a numeric deviation value, a list, or an assoc, with the list specifying either an assoc followed optionally by the default deviation. This inner assoc, regardless of whether it is in a list, maps the value to each actual value's deviation. If any vector value is null or evaluates to nan, or any of the differences between vector1 and vector2 evaluate to null or nan, then it will compute a corresponding maximum distance value based on the properties of the feature. If surprisal space is true, which defaults to false, it will perform all computations in surprisal space."
"description": "generalized_distance list|assoc|number weights list|assoc distance_types list|assoc attributes list|assoc|number deviations number p_value list|assoc|* vector1 [list|assoc|* vector2] [list value_names] [bool surprisal_space] || Computes the generalized norm between vector1 and vector2 (or an equivalent zero vector if unspecified) with parameter specified by the p_value (2 being Euclidian distance), using the numerical distance or edit distance as appropriate. The parameter value_names, if specified as a list of the names of the values, will transform via unzipping any assoc into a list for the respective parameter in the order of the value_names, or if a number will use the number repeatedly for every element. weights is a list of dimension weights to use for the query, each value mapping to its respective element in the vectors. If weights is null, then it will assume that the weights are 1 and additionally will ignore null values for the vectors instead of treating them as unknown differences. The parameter distance_types is either a list strings or an assoc of strings indicating the type of distance for each feature. Allowed values are \"nominal_numeric\", \"nominal_string\", \"nominal_code\", \"continuous_numeric\", \"continuous_numeric_cyclic\", \"continuous_string\", and \"continuous_code\". Nominals evaluate whether the two values are the same and continuous evaluates the difference between the two values. The numeric, string, or code modifier specifies how the difference is measured, and cyclic means it is a difference that wraps around. \nFor attributes, the particular distance_types specifies what particular attributes are expected. For a nominal distance_type, a number indicates the nominal count, whereas null will infer from the values given. Cyclic requires a single value, which is the upper bound of the difference for the cycle range (e.g., if the value is 360, then the supremum difference between two values will be 360, leading 1 and 359 to have a difference of 2).\n Deviations are used during distance calculation to specify uncertainty per-element, the minimum difference between two values prior to exponentiation. Specifying null as a deviation is equivalent to setting each deviation to 0. Each deviation for each feature can be a single value or a list. If it is a single value, that value is used as the deviation and differences and deviations for null values will automatically computed from the data based on the maximum difference. If a deviation is provided as a list, then the first value is the deviation, the second value is the difference to use when one of the values being compared is null, and the third value is the difference to use when both of the values are null. If the third value is omitted, it will use the second value for both. If both of the null values are omitted, then it will compute the maximum difference and use that for both. For nominal types, the value for each feature can be a numeric deviation, an assoc, or a list. If the value is an assoc it specifies deviation information, where each key of the assoc is the nominal value, and each value of the assoc can be a numeric deviation value, a list, or an assoc, with the list specifying either an assoc followed optionally by the default deviation. This inner assoc, regardless of whether it is in a list, maps the value to each actual value's deviation. If any vector value is null or any of the differences between vector1 and vector2 evaluate to null, then it will compute a corresponding maximum distance value based on the properties of the feature. If surprisal space is true, which defaults to false, it will perform all computations in surprisal space."
},
"(entropy": {
"prefix": "(entropy",
Expand Down Expand Up @@ -431,7 +431,7 @@
"body": [
"(filter"
],
"description": "filter [* function] list|assoc collection || For each element in the collection, pushes a new target scope onto the stack, so that current_value accesses the element in the list and current_index accesses the list or assoc index, with target representing the original list or assoc, and evaluates the function. If function evaluates to true, then the element is put in a new list or assoc (matching the input type) that is returned. If function is omitted, then it will remove any elements in the collection that are null, .nan, or .nas string."
"description": "filter [* function] list|assoc collection || For each element in the collection, pushes a new target scope onto the stack, so that current_value accesses the element in the list and current_index accesses the list or assoc index, with target representing the original list or assoc, and evaluates the function. If function evaluates to true, then the element is put in a new list or assoc (matching the input type) that is returned. If function is omitted, then it will remove any elements in the collection that are null."
},
"(weave": {
"prefix": "(weave",
Expand Down Expand Up @@ -634,7 +634,7 @@
"body": [
"(="
],
"description": "= [* node1] [* node2] ... [* nodeN] || Evaluates to true if all values are equal (will recurse into data structures), false otherwise. Values of nan (not a number) are considered equal because they represent the same node, unlike many other floating point representation systems."
"description": "= [* node1] [* node2] ... [* nodeN] || Evaluates to true if all values are equal (will recurse into data structures), false otherwise. Values of null are considered equal."
},
"(!=": {
"prefix": "(!=",
Expand Down Expand Up @@ -697,7 +697,7 @@
"body": [
"(weighted_rand"
],
"description": "weighted_rand [list of lists|assoc weighted_values] [number number_to_generate] [bool unique] || Each entity has its own random stream, and if called from a sandbox, then it uses a new stream without interrupting the stream of the calling entity. If the parameter is a list, it will uniformly randomly choose and evaluate to one element of the list. If an assoc, then it will randomly evaluate to one of the keys using the values as the weights for the probabilities. Nans and negative numbers are treated as zero. Infinities are normalized as to only select from infinities in the list. If all values are 0, then they are normalized to having the same weight. If a list of lists, it will use the first list as a list of values and the second list as a list of weights and otherwise work like it would for an assoc. If number_to_generate is specified, it will generate a list of multiple values (even if number_to_generate is 1). If unique is true (it defaults to false), then it will only return unique values, the same as selecting from the list or assoc without replacement."
"description": "weighted_rand [list of lists|assoc weighted_values] [number number_to_generate] [bool unique] || Each entity has its own random stream, and if called from a sandbox, then it uses a new stream without interrupting the stream of the calling entity. If the parameter is a list, it will uniformly randomly choose and evaluate to one element of the list. If an assoc, then it will randomly evaluate to one of the keys using the values as the weights for the probabilities. Nulls and negative numbers are treated as zero. Infinities are normalized as to only select from infinities in the list. If all values are 0, then they are normalized to having the same weight. If a list of lists, it will use the first list as a list of values and the second list as a list of weights and otherwise work like it would for an assoc. If number_to_generate is specified, it will generate a list of multiple values (even if number_to_generate is 1). If unique is true (it defaults to false), then it will only return unique values, the same as selecting from the list or assoc without replacement."
},
"(get_rand_seed": {
"prefix": "(get_rand_seed",
Expand Down Expand Up @@ -746,14 +746,14 @@
"body": [
"(list"
],
"description": "list [* node1] [* node2] ... [* nodeN] || Evaluates to the list specified by the parameters. Pushes a new target scope such that (target), (current_index), and (current_value) access the list, the current index, and the current value."
"description": "list [* node1] [* node2] ... [* nodeN] || Evaluates to the list specified by the parameters. Pushes a new target scope such that (target), (current_index), and (current_value) access the list, the current index, and the current value. If []'s are used instead of parenthesis, the keyword list may be omitted. [] are considered identical to (list)."
},
"(assoc": {
"prefix": "(assoc",
"body": [
"(assoc"
],
"description": "assoc [bstring index1] [* value1] [bstring index1] [* value2] ... || Evaluates to the associative list, where each pair of parameters (e.g., index1 and value1) comprises a index/value pair. Pushes a new target scope such that (target), (current_index), and (current_value) access the assoc, the current index, and the current value. If any of the bstrings do not have reserved characters or spaces, then quotes are optional; if spaces or reserved characters are present, then quotes are required."
"description": "assoc [bstring index1] [* value1] [bstring index1] [* value2] ... || Evaluates to the associative list, where each pair of parameters (e.g., index1 and value1) comprises a index/value pair. Pushes a new target scope such that (target), (current_index), and (current_value) access the assoc, the current index, and the current value. If any of the bstrings do not have reserved characters or spaces, then quotes are optional; if spaces or reserved characters are present, then quotes are required. If {}'s are used instead of parenthesis, the keyword assoc may be omitted. {} are considered identical to (assoc)"
},
"([number]": {
"prefix": "([number]",
Expand Down Expand Up @@ -1327,7 +1327,7 @@
"body": [
"(query_mode"
],
"description": "query_mode string label_name [string weight_label_name] [bool numeric] || When used as a query argument, finds the statistical mode of label_name for numerical data. If weight_label_name is specified, it will find the weighted mode. If numeric is true, its default, then it will treat all values as numeric, otherwise it will treat them all as strings. If numeric and no numeric mode exists, it will return .nan, but if string and no string mode exists, it will return null."
"description": "query_mode string label_name [string weight_label_name] [bool numeric] || When used as a query argument, finds the statistical mode of label_name for numerical data. If weight_label_name is specified, it will find the weighted mode. If numeric is true, its default, then it will treat all values as numeric, otherwise it will treat them all as strings. If numeric and no numeric mode exists, it will return (null), but if string and no string mode exists, it will return null."
},
"(query_quantile": {
"prefix": "(query_quantile",
Expand Down
4 changes: 2 additions & 2 deletions src/language/symbols.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ export class AmalgamDocumentSymbolProvider implements vscode.DocumentSymbolProvi
}

private checkType(text: string, defaultKind: vscode.SymbolKind) {
if (/^(?:["'](?:[^"\\]|\\.)*["']|\.nas)(?:\s*;.*)?$/.test(text)) {
if (/^(?:["'](?:[^"\\]|\\.)*["'])(?:\s*;.*)?$/.test(text)) {
return vscode.SymbolKind.String;
} else if (/^(?:\d+\.?\d*|\.nan|-?\.infinity)(?:\s*;.*)?$/.test(text)) {
} else if (/^(?:\d+\.?\d*|-?\.infinity)(?:\s*;.*)?$/.test(text)) {
return vscode.SymbolKind.Number;
} else if (/^\((?:true|false)\)(?:\s*;.*)?$/i.test(text)) {
return vscode.SymbolKind.Boolean;
Expand Down
2 changes: 1 addition & 1 deletion syntaxes/amalgam.tmLanguage.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
"name": "keyword.control.amalgam"
},
{
"match": "(argv|interpreter|\\.nan|\\.nas|\\.infinity|-\\.infinity|(?<=\\()(null|false|true|rand|query_count))",
"match": "(argv|interpreter|\\.infinity|-\\.infinity|(?<=\\()(null|false|true|rand|query_count))",
"name": "constant.language.amalgam"
},
{
Expand Down

0 comments on commit c86d565

Please sign in to comment.