Rename 'type defintion' to 'type specification'
This commit is contained in:
parent
8224f7fe3c
commit
ed6e4cfd1a
@ -2,13 +2,13 @@ use serde::{Deserialize, Serialize};
|
|||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
AbstractTree, AssignmentOperator, Error, Format, Identifier, Map, Result, Statement,
|
AbstractTree, AssignmentOperator, Error, Format, Identifier, Map, Result, Statement,
|
||||||
SyntaxNode, SyntaxPosition, Type, TypeDefinition, Value,
|
SyntaxNode, SyntaxPosition, Type, TypeSpecification, Value,
|
||||||
};
|
};
|
||||||
|
|
||||||
#[derive(Debug, Clone, Serialize, Deserialize, Eq, PartialEq, PartialOrd, Ord)]
|
#[derive(Debug, Clone, Serialize, Deserialize, Eq, PartialEq, PartialOrd, Ord)]
|
||||||
pub struct Assignment {
|
pub struct Assignment {
|
||||||
identifier: Identifier,
|
identifier: Identifier,
|
||||||
type_definition: Option<TypeDefinition>,
|
type_specification: Option<TypeSpecification>,
|
||||||
operator: AssignmentOperator,
|
operator: AssignmentOperator,
|
||||||
statement: Statement,
|
statement: Statement,
|
||||||
|
|
||||||
@ -25,8 +25,8 @@ impl AbstractTree for Assignment {
|
|||||||
let identifier = Identifier::from_syntax(identifier_node, source, context)?;
|
let identifier = Identifier::from_syntax(identifier_node, source, context)?;
|
||||||
|
|
||||||
let type_node = syntax_node.child(1).unwrap();
|
let type_node = syntax_node.child(1).unwrap();
|
||||||
let type_definition = if type_node.kind() == "type_definition" {
|
let type_specification = if type_node.kind() == "type_specification" {
|
||||||
Some(TypeDefinition::from_syntax(type_node, source, context)?)
|
Some(TypeSpecification::from_syntax(type_node, source, context)?)
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
};
|
};
|
||||||
@ -38,7 +38,7 @@ impl AbstractTree for Assignment {
|
|||||||
let statement = Statement::from_syntax(statement_node, source, context)?;
|
let statement = Statement::from_syntax(statement_node, source, context)?;
|
||||||
|
|
||||||
if let AssignmentOperator::Equal = operator {
|
if let AssignmentOperator::Equal = operator {
|
||||||
let r#type = if let Some(definition) = &type_definition {
|
let r#type = if let Some(definition) = &type_specification {
|
||||||
definition.inner().clone()
|
definition.inner().clone()
|
||||||
} else {
|
} else {
|
||||||
statement.expected_type(context)?
|
statement.expected_type(context)?
|
||||||
@ -49,7 +49,7 @@ impl AbstractTree for Assignment {
|
|||||||
|
|
||||||
Ok(Assignment {
|
Ok(Assignment {
|
||||||
identifier,
|
identifier,
|
||||||
type_definition,
|
type_specification,
|
||||||
operator,
|
operator,
|
||||||
statement,
|
statement,
|
||||||
syntax_position: syntax_node.range().into(),
|
syntax_position: syntax_node.range().into(),
|
||||||
@ -59,21 +59,21 @@ impl AbstractTree for Assignment {
|
|||||||
fn check_type(&self, source: &str, context: &Map) -> Result<()> {
|
fn check_type(&self, source: &str, context: &Map) -> Result<()> {
|
||||||
let actual_type = self.statement.expected_type(context)?;
|
let actual_type = self.statement.expected_type(context)?;
|
||||||
|
|
||||||
if let Some(type_definition) = &self.type_definition {
|
if let Some(type_specification) = &self.type_specification {
|
||||||
match self.operator {
|
match self.operator {
|
||||||
AssignmentOperator::Equal => {
|
AssignmentOperator::Equal => {
|
||||||
type_definition
|
type_specification
|
||||||
.inner()
|
.inner()
|
||||||
.check(&actual_type)
|
.check(&actual_type)
|
||||||
.map_err(|error| error.at_source_position(source, self.syntax_position))?;
|
.map_err(|error| error.at_source_position(source, self.syntax_position))?;
|
||||||
}
|
}
|
||||||
AssignmentOperator::PlusEqual => {
|
AssignmentOperator::PlusEqual => {
|
||||||
if let Type::List(item_type) = type_definition.inner() {
|
if let Type::List(item_type) = type_specification.inner() {
|
||||||
item_type.check(&actual_type).map_err(|error| {
|
item_type.check(&actual_type).map_err(|error| {
|
||||||
error.at_source_position(source, self.syntax_position)
|
error.at_source_position(source, self.syntax_position)
|
||||||
})?;
|
})?;
|
||||||
} else {
|
} else {
|
||||||
type_definition
|
type_specification
|
||||||
.inner()
|
.inner()
|
||||||
.check(&self.identifier.expected_type(context)?)
|
.check(&self.identifier.expected_type(context)?)
|
||||||
.map_err(|error| {
|
.map_err(|error| {
|
||||||
@ -142,8 +142,8 @@ impl Format for Assignment {
|
|||||||
fn format(&self, output: &mut String, indent_level: u8) {
|
fn format(&self, output: &mut String, indent_level: u8) {
|
||||||
self.identifier.format(output, indent_level);
|
self.identifier.format(output, indent_level);
|
||||||
|
|
||||||
if let Some(type_definition) = &self.type_definition {
|
if let Some(type_specification) = &self.type_specification {
|
||||||
type_definition.format(output, indent_level);
|
type_specification.format(output, indent_level);
|
||||||
}
|
}
|
||||||
|
|
||||||
output.push(' ');
|
output.push(' ');
|
||||||
|
@ -4,7 +4,7 @@ use serde::{Deserialize, Serialize};
|
|||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
AbstractTree, Block, Error, Format, Function, Identifier, Map, Result, SyntaxNode,
|
AbstractTree, Block, Error, Format, Function, Identifier, Map, Result, SyntaxNode,
|
||||||
SyntaxPosition, Type, TypeDefinition, Value,
|
SyntaxPosition, Type, TypeSpecification, Value,
|
||||||
};
|
};
|
||||||
|
|
||||||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, PartialOrd, Ord)]
|
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, PartialOrd, Ord)]
|
||||||
@ -98,15 +98,16 @@ impl AbstractTree for FunctionNode {
|
|||||||
parameters.push(identifier);
|
parameters.push(identifier);
|
||||||
}
|
}
|
||||||
|
|
||||||
if child.kind() == "type_definition" {
|
if child.kind() == "type_specification" {
|
||||||
let type_definition = TypeDefinition::from_syntax(child, source, outer_context)?;
|
let type_specification =
|
||||||
|
TypeSpecification::from_syntax(child, source, outer_context)?;
|
||||||
|
|
||||||
parameter_types.push(type_definition.take_inner());
|
parameter_types.push(type_specification.take_inner());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let return_type_node = node.child(child_count - 2).unwrap();
|
let return_type_node = node.child(child_count - 2).unwrap();
|
||||||
let return_type = TypeDefinition::from_syntax(return_type_node, source, outer_context)?;
|
let return_type = TypeSpecification::from_syntax(return_type_node, source, outer_context)?;
|
||||||
|
|
||||||
let function_context = Map::new();
|
let function_context = Map::new();
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ pub mod math;
|
|||||||
pub mod math_operator;
|
pub mod math_operator;
|
||||||
pub mod statement;
|
pub mod statement;
|
||||||
pub mod r#type;
|
pub mod r#type;
|
||||||
pub mod type_definition;
|
pub mod type_specification;
|
||||||
pub mod value_node;
|
pub mod value_node;
|
||||||
pub mod r#while;
|
pub mod r#while;
|
||||||
pub mod r#yield;
|
pub mod r#yield;
|
||||||
@ -37,7 +37,7 @@ pub use {
|
|||||||
function_call::*, function_expression::*, function_node::*, identifier::*, if_else::*,
|
function_call::*, function_expression::*, function_node::*, identifier::*, if_else::*,
|
||||||
index::*, index_assignment::IndexAssignment, index_expression::*, logic::*, logic_operator::*,
|
index::*, index_assignment::IndexAssignment, index_expression::*, logic::*, logic_operator::*,
|
||||||
math::*, math_operator::*, r#for::*, r#match::*, r#type::*, r#while::*, r#yield::*,
|
math::*, math_operator::*, r#for::*, r#match::*, r#type::*, r#while::*, r#yield::*,
|
||||||
statement::*, type_definition::*, value_node::*,
|
statement::*, type_specification::*, value_node::*,
|
||||||
};
|
};
|
||||||
|
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
@ -3,11 +3,11 @@ use serde::{Deserialize, Serialize};
|
|||||||
use crate::{AbstractTree, Error, Format, Map, Result, SyntaxNode, Type, Value};
|
use crate::{AbstractTree, Error, Format, Map, Result, SyntaxNode, Type, Value};
|
||||||
|
|
||||||
#[derive(Debug, Clone, Serialize, Deserialize, Eq, PartialEq, PartialOrd, Ord)]
|
#[derive(Debug, Clone, Serialize, Deserialize, Eq, PartialEq, PartialOrd, Ord)]
|
||||||
pub struct TypeDefinition {
|
pub struct TypeSpecification {
|
||||||
r#type: Type,
|
r#type: Type,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl TypeDefinition {
|
impl TypeSpecification {
|
||||||
pub fn new(r#type: Type) -> Self {
|
pub fn new(r#type: Type) -> Self {
|
||||||
Self { r#type }
|
Self { r#type }
|
||||||
}
|
}
|
||||||
@ -21,14 +21,14 @@ impl TypeDefinition {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl AbstractTree for TypeDefinition {
|
impl AbstractTree for TypeSpecification {
|
||||||
fn from_syntax(node: SyntaxNode, source: &str, context: &Map) -> Result<Self> {
|
fn from_syntax(node: SyntaxNode, source: &str, context: &Map) -> Result<Self> {
|
||||||
Error::expect_syntax_node(source, "type_definition", node)?;
|
Error::expect_syntax_node(source, "type_specification", node)?;
|
||||||
|
|
||||||
let type_node = node.child(1).unwrap();
|
let type_node = node.child(1).unwrap();
|
||||||
let r#type = Type::from_syntax(type_node, source, context)?;
|
let r#type = Type::from_syntax(type_node, source, context)?;
|
||||||
|
|
||||||
Ok(TypeDefinition { r#type })
|
Ok(TypeSpecification { r#type })
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run(&self, source: &str, context: &Map) -> Result<Value> {
|
fn run(&self, source: &str, context: &Map) -> Result<Value> {
|
||||||
@ -40,7 +40,7 @@ impl AbstractTree for TypeDefinition {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Format for TypeDefinition {
|
impl Format for TypeSpecification {
|
||||||
fn format(&self, output: &mut String, indent_level: u8) {
|
fn format(&self, output: &mut String, indent_level: u8) {
|
||||||
output.push('<');
|
output.push('<');
|
||||||
self.r#type.format(output, indent_level);
|
self.r#type.format(output, indent_level);
|
@ -4,7 +4,7 @@ use serde::{Deserialize, Serialize};
|
|||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
AbstractTree, BuiltInValue, Error, Expression, Format, Function, FunctionNode, Identifier,
|
AbstractTree, BuiltInValue, Error, Expression, Format, Function, FunctionNode, Identifier,
|
||||||
List, Map, Result, Statement, Structure, SyntaxNode, Type, TypeDefinition, Value,
|
List, Map, Result, Statement, Structure, SyntaxNode, Type, TypeSpecification, Value,
|
||||||
};
|
};
|
||||||
|
|
||||||
#[derive(Debug, Clone, Serialize, Deserialize, Eq, PartialEq, PartialOrd, Ord)]
|
#[derive(Debug, Clone, Serialize, Deserialize, Eq, PartialEq, PartialOrd, Ord)]
|
||||||
@ -67,16 +67,17 @@ impl AbstractTree for ValueNode {
|
|||||||
current_type = None;
|
current_type = None;
|
||||||
}
|
}
|
||||||
|
|
||||||
if child.kind() == "type_definition" {
|
if child.kind() == "type_specification" {
|
||||||
current_type =
|
current_type = Some(
|
||||||
Some(TypeDefinition::from_syntax(child, source, context)?.take_inner());
|
TypeSpecification::from_syntax(child, source, context)?.take_inner(),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if child.kind() == "statement" {
|
if child.kind() == "statement" {
|
||||||
let statement = Statement::from_syntax(child, source, context)?;
|
let statement = Statement::from_syntax(child, source, context)?;
|
||||||
|
|
||||||
if let Some(type_definition) = ¤t_type {
|
if let Some(type_specification) = ¤t_type {
|
||||||
type_definition.check(&statement.expected_type(context)?)?;
|
type_specification.check(&statement.expected_type(context)?)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
child_nodes.insert(current_key.clone(), (statement, current_type.clone()));
|
child_nodes.insert(current_key.clone(), (statement, current_type.clone()));
|
||||||
@ -130,9 +131,9 @@ impl AbstractTree for ValueNode {
|
|||||||
Some(Identifier::from_syntax(child_syntax_node, source, context)?);
|
Some(Identifier::from_syntax(child_syntax_node, source, context)?);
|
||||||
}
|
}
|
||||||
|
|
||||||
if child_syntax_node.kind() == "type_definition" {
|
if child_syntax_node.kind() == "type_specification" {
|
||||||
current_type = Some(
|
current_type = Some(
|
||||||
TypeDefinition::from_syntax(child_syntax_node, source, context)?
|
TypeSpecification::from_syntax(child_syntax_node, source, context)?
|
||||||
.take_inner(),
|
.take_inner(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
//! Types that represent runtime values.
|
//! Types that represent runtime values.
|
||||||
use crate::{
|
use crate::{
|
||||||
error::{Error, Result},
|
error::{Error, Result},
|
||||||
Function, Identifier, List, Map, Structure, Type, TypeDefinition,
|
Function, Identifier, List, Map, Structure, Type, TypeSpecification,
|
||||||
};
|
};
|
||||||
|
|
||||||
use serde::{
|
use serde::{
|
||||||
@ -81,7 +81,7 @@ impl Value {
|
|||||||
for (key, (value, _)) in map.variables().unwrap().iter() {
|
for (key, (value, _)) in map.variables().unwrap().iter() {
|
||||||
identifier_types.push((
|
identifier_types.push((
|
||||||
Identifier::new(key.clone()),
|
Identifier::new(key.clone()),
|
||||||
TypeDefinition::new(value.r#type()),
|
TypeSpecification::new(value.r#type()),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ x <int> = y
|
|||||||
(statement
|
(statement
|
||||||
(assignment
|
(assignment
|
||||||
(identifier)
|
(identifier)
|
||||||
(type_definition
|
(type_specification
|
||||||
(type))
|
(type))
|
||||||
(assignment_operator)
|
(assignment_operator)
|
||||||
(statement
|
(statement
|
||||||
|
@ -11,7 +11,7 @@ Anonymous Function
|
|||||||
(expression
|
(expression
|
||||||
(value
|
(value
|
||||||
(function
|
(function
|
||||||
(type_definition
|
(type_specification
|
||||||
(type))
|
(type))
|
||||||
(block
|
(block
|
||||||
(statement
|
(statement
|
||||||
@ -39,12 +39,12 @@ foobar = (x <int>, y <int>) <int> {
|
|||||||
(value
|
(value
|
||||||
(function
|
(function
|
||||||
(identifier)
|
(identifier)
|
||||||
(type_definition
|
(type_specification
|
||||||
(type))
|
(type))
|
||||||
(identifier)
|
(identifier)
|
||||||
(type_definition
|
(type_specification
|
||||||
(type))
|
(type))
|
||||||
(type_definition
|
(type_specification
|
||||||
(type))
|
(type))
|
||||||
(block
|
(block
|
||||||
(statement
|
(statement
|
||||||
@ -132,9 +132,9 @@ Anonymous Function Call
|
|||||||
(value
|
(value
|
||||||
(function
|
(function
|
||||||
(identifier)
|
(identifier)
|
||||||
(type_definition
|
(type_specification
|
||||||
(type))
|
(type))
|
||||||
(type_definition
|
(type_specification
|
||||||
(type))
|
(type))
|
||||||
(block
|
(block
|
||||||
(statement
|
(statement
|
||||||
@ -202,7 +202,7 @@ x(() <bool> { true })
|
|||||||
(expression
|
(expression
|
||||||
(value
|
(value
|
||||||
(function
|
(function
|
||||||
(type_definition
|
(type_specification
|
||||||
(type))
|
(type))
|
||||||
(block
|
(block
|
||||||
(statement
|
(statement
|
||||||
|
@ -34,14 +34,14 @@ Map with Types
|
|||||||
(value
|
(value
|
||||||
(map
|
(map
|
||||||
(identifier)
|
(identifier)
|
||||||
(type_definition
|
(type_specification
|
||||||
(type))
|
(type))
|
||||||
(statement
|
(statement
|
||||||
(expression
|
(expression
|
||||||
(value
|
(value
|
||||||
(integer))))
|
(integer))))
|
||||||
(identifier)
|
(identifier)
|
||||||
(type_definition
|
(type_specification
|
||||||
(type
|
(type
|
||||||
(type)))
|
(type)))
|
||||||
(statement
|
(statement
|
||||||
|
@ -15,10 +15,10 @@ struct {
|
|||||||
(value
|
(value
|
||||||
(structure
|
(structure
|
||||||
(identifier)
|
(identifier)
|
||||||
(type_definition
|
(type_specification
|
||||||
(type))
|
(type))
|
||||||
(identifier)
|
(identifier)
|
||||||
(type_definition
|
(type_specification
|
||||||
(type)))))))
|
(type)))))))
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
@ -46,17 +46,17 @@ Foo = struct {
|
|||||||
(value
|
(value
|
||||||
(structure
|
(structure
|
||||||
(identifier)
|
(identifier)
|
||||||
(type_definition
|
(type_specification
|
||||||
(type))
|
(type))
|
||||||
(identifier)
|
(identifier)
|
||||||
(type_definition
|
(type_specification
|
||||||
(type))
|
(type))
|
||||||
(statement
|
(statement
|
||||||
(expression
|
(expression
|
||||||
(value
|
(value
|
||||||
(float))))
|
(float))))
|
||||||
(identifier)
|
(identifier)
|
||||||
(type_definition
|
(type_specification
|
||||||
(type
|
(type
|
||||||
(identifier)))
|
(identifier)))
|
||||||
(statement
|
(statement
|
||||||
|
@ -96,7 +96,7 @@ module.exports = grammar({
|
|||||||
choice(
|
choice(
|
||||||
seq(
|
seq(
|
||||||
$.identifier,
|
$.identifier,
|
||||||
$.type_definition,
|
$.type_specification,
|
||||||
),
|
),
|
||||||
seq(
|
seq(
|
||||||
$.identifier,
|
$.identifier,
|
||||||
@ -105,7 +105,7 @@ module.exports = grammar({
|
|||||||
),
|
),
|
||||||
seq(
|
seq(
|
||||||
$.identifier,
|
$.identifier,
|
||||||
$.type_definition,
|
$.type_specification,
|
||||||
'=',
|
'=',
|
||||||
$.statement,
|
$.statement,
|
||||||
),
|
),
|
||||||
@ -128,7 +128,7 @@ module.exports = grammar({
|
|||||||
),
|
),
|
||||||
seq(
|
seq(
|
||||||
$.identifier,
|
$.identifier,
|
||||||
$.type_definition,
|
$.type_specification,
|
||||||
'=',
|
'=',
|
||||||
$.statement,
|
$.statement,
|
||||||
),
|
),
|
||||||
@ -224,7 +224,7 @@ module.exports = grammar({
|
|||||||
repeat1(
|
repeat1(
|
||||||
seq(
|
seq(
|
||||||
$.identifier,
|
$.identifier,
|
||||||
optional($.type_definition),
|
optional($.type_specification),
|
||||||
'=',
|
'=',
|
||||||
$.statement,
|
$.statement,
|
||||||
optional(','),
|
optional(','),
|
||||||
@ -310,7 +310,7 @@ module.exports = grammar({
|
|||||||
assignment: $ =>
|
assignment: $ =>
|
||||||
seq(
|
seq(
|
||||||
$.identifier,
|
$.identifier,
|
||||||
optional($.type_definition),
|
optional($.type_specification),
|
||||||
$.assignment_operator,
|
$.assignment_operator,
|
||||||
$.statement,
|
$.statement,
|
||||||
),
|
),
|
||||||
@ -387,7 +387,7 @@ module.exports = grammar({
|
|||||||
seq('return', $.statement),
|
seq('return', $.statement),
|
||||||
),
|
),
|
||||||
|
|
||||||
type_definition: $ =>
|
type_specification: $ =>
|
||||||
seq('<', $.type, '>'),
|
seq('<', $.type, '>'),
|
||||||
|
|
||||||
type: $ =>
|
type: $ =>
|
||||||
@ -430,12 +430,12 @@ module.exports = grammar({
|
|||||||
repeat(
|
repeat(
|
||||||
seq(
|
seq(
|
||||||
$.identifier,
|
$.identifier,
|
||||||
$.type_definition,
|
$.type_specification,
|
||||||
optional(','),
|
optional(','),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
')',
|
')',
|
||||||
$.type_definition,
|
$.type_specification,
|
||||||
$.block,
|
$.block,
|
||||||
),
|
),
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
|
|
||||||
[
|
[
|
||||||
(type)
|
(type)
|
||||||
(type_definition)
|
(type_specification)
|
||||||
] @type
|
] @type
|
||||||
|
|
||||||
(assignment_operator) @operator.assignment
|
(assignment_operator) @operator.assignment
|
||||||
|
@ -280,7 +280,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "SYMBOL",
|
"type": "SYMBOL",
|
||||||
"name": "type_definition"
|
"name": "type_specification"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@ -310,7 +310,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "SYMBOL",
|
"type": "SYMBOL",
|
||||||
"name": "type_definition"
|
"name": "type_specification"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "STRING",
|
"type": "STRING",
|
||||||
@ -377,7 +377,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "SYMBOL",
|
"type": "SYMBOL",
|
||||||
"name": "type_definition"
|
"name": "type_specification"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "STRING",
|
"type": "STRING",
|
||||||
@ -673,7 +673,7 @@
|
|||||||
"members": [
|
"members": [
|
||||||
{
|
{
|
||||||
"type": "SYMBOL",
|
"type": "SYMBOL",
|
||||||
"name": "type_definition"
|
"name": "type_specification"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "BLANK"
|
"type": "BLANK"
|
||||||
@ -939,7 +939,7 @@
|
|||||||
"members": [
|
"members": [
|
||||||
{
|
{
|
||||||
"type": "SYMBOL",
|
"type": "SYMBOL",
|
||||||
"name": "type_definition"
|
"name": "type_specification"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "BLANK"
|
"type": "BLANK"
|
||||||
@ -1207,7 +1207,7 @@
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"type_definition": {
|
"type_specification": {
|
||||||
"type": "SEQ",
|
"type": "SEQ",
|
||||||
"members": [
|
"members": [
|
||||||
{
|
{
|
||||||
@ -1387,7 +1387,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "SYMBOL",
|
"type": "SYMBOL",
|
||||||
"name": "type_definition"
|
"name": "type_specification"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "CHOICE",
|
"type": "CHOICE",
|
||||||
@ -1410,7 +1410,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "SYMBOL",
|
"type": "SYMBOL",
|
||||||
"name": "type_definition"
|
"name": "type_specification"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "SYMBOL",
|
"type": "SYMBOL",
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
"named": true
|
"named": true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "type_definition",
|
"type": "type_specification",
|
||||||
"named": true
|
"named": true
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@ -173,7 +173,7 @@
|
|||||||
"named": true
|
"named": true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "type_definition",
|
"type": "type_specification",
|
||||||
"named": true
|
"named": true
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@ -396,7 +396,7 @@
|
|||||||
"named": true
|
"named": true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "type_definition",
|
"type": "type_specification",
|
||||||
"named": true
|
"named": true
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@ -462,7 +462,7 @@
|
|||||||
"named": true
|
"named": true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "type_definition",
|
"type": "type_specification",
|
||||||
"named": true
|
"named": true
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@ -577,7 +577,7 @@
|
|||||||
"named": true
|
"named": true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "type_definition",
|
"type": "type_specification",
|
||||||
"named": true
|
"named": true
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@ -603,7 +603,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "type_definition",
|
"type": "type_specification",
|
||||||
"named": true,
|
"named": true,
|
||||||
"fields": {},
|
"fields": {},
|
||||||
"children": {
|
"children": {
|
||||||
|
@ -114,7 +114,7 @@ enum {
|
|||||||
sym_while = 95,
|
sym_while = 95,
|
||||||
sym_for = 96,
|
sym_for = 96,
|
||||||
sym_return = 97,
|
sym_return = 97,
|
||||||
sym_type_definition = 98,
|
sym_type_specification = 98,
|
||||||
sym_type = 99,
|
sym_type = 99,
|
||||||
sym_function = 100,
|
sym_function = 100,
|
||||||
sym_function_expression = 101,
|
sym_function_expression = 101,
|
||||||
@ -232,7 +232,7 @@ static const char * const ts_symbol_names[] = {
|
|||||||
[sym_while] = "while",
|
[sym_while] = "while",
|
||||||
[sym_for] = "for",
|
[sym_for] = "for",
|
||||||
[sym_return] = "return",
|
[sym_return] = "return",
|
||||||
[sym_type_definition] = "type_definition",
|
[sym_type_specification] = "type_specification",
|
||||||
[sym_type] = "type",
|
[sym_type] = "type",
|
||||||
[sym_function] = "function",
|
[sym_function] = "function",
|
||||||
[sym_function_expression] = "function_expression",
|
[sym_function_expression] = "function_expression",
|
||||||
@ -350,7 +350,7 @@ static const TSSymbol ts_symbol_map[] = {
|
|||||||
[sym_while] = sym_while,
|
[sym_while] = sym_while,
|
||||||
[sym_for] = sym_for,
|
[sym_for] = sym_for,
|
||||||
[sym_return] = sym_return,
|
[sym_return] = sym_return,
|
||||||
[sym_type_definition] = sym_type_definition,
|
[sym_type_specification] = sym_type_specification,
|
||||||
[sym_type] = sym_type,
|
[sym_type] = sym_type,
|
||||||
[sym_function] = sym_function,
|
[sym_function] = sym_function,
|
||||||
[sym_function_expression] = sym_function_expression,
|
[sym_function_expression] = sym_function_expression,
|
||||||
@ -762,7 +762,7 @@ static const TSSymbolMetadata ts_symbol_metadata[] = {
|
|||||||
.visible = true,
|
.visible = true,
|
||||||
.named = true,
|
.named = true,
|
||||||
},
|
},
|
||||||
[sym_type_definition] = {
|
[sym_type_specification] = {
|
||||||
.visible = true,
|
.visible = true,
|
||||||
.named = true,
|
.named = true,
|
||||||
},
|
},
|
||||||
@ -5960,7 +5960,7 @@ static const uint16_t ts_small_parse_table[] = {
|
|||||||
STATE(46), 1,
|
STATE(46), 1,
|
||||||
sym_assignment_operator,
|
sym_assignment_operator,
|
||||||
STATE(393), 1,
|
STATE(393), 1,
|
||||||
sym_type_definition,
|
sym_type_specification,
|
||||||
ACTIONS(234), 2,
|
ACTIONS(234), 2,
|
||||||
anon_sym_PLUS_EQ,
|
anon_sym_PLUS_EQ,
|
||||||
anon_sym_DASH_EQ,
|
anon_sym_DASH_EQ,
|
||||||
@ -7156,7 +7156,7 @@ static const uint16_t ts_small_parse_table[] = {
|
|||||||
STATE(46), 1,
|
STATE(46), 1,
|
||||||
sym_assignment_operator,
|
sym_assignment_operator,
|
||||||
STATE(390), 1,
|
STATE(390), 1,
|
||||||
sym_type_definition,
|
sym_type_specification,
|
||||||
ACTIONS(234), 2,
|
ACTIONS(234), 2,
|
||||||
anon_sym_PLUS_EQ,
|
anon_sym_PLUS_EQ,
|
||||||
anon_sym_DASH_EQ,
|
anon_sym_DASH_EQ,
|
||||||
@ -10269,7 +10269,7 @@ static const uint16_t ts_small_parse_table[] = {
|
|||||||
STATE(29), 1,
|
STATE(29), 1,
|
||||||
sym_assignment_operator,
|
sym_assignment_operator,
|
||||||
STATE(391), 1,
|
STATE(391), 1,
|
||||||
sym_type_definition,
|
sym_type_specification,
|
||||||
ACTIONS(234), 2,
|
ACTIONS(234), 2,
|
||||||
anon_sym_PLUS_EQ,
|
anon_sym_PLUS_EQ,
|
||||||
anon_sym_DASH_EQ,
|
anon_sym_DASH_EQ,
|
||||||
@ -19415,7 +19415,7 @@ static const uint16_t ts_small_parse_table[] = {
|
|||||||
STATE(40), 1,
|
STATE(40), 1,
|
||||||
sym_assignment_operator,
|
sym_assignment_operator,
|
||||||
STATE(392), 1,
|
STATE(392), 1,
|
||||||
sym_type_definition,
|
sym_type_specification,
|
||||||
ACTIONS(234), 2,
|
ACTIONS(234), 2,
|
||||||
anon_sym_PLUS_EQ,
|
anon_sym_PLUS_EQ,
|
||||||
anon_sym_DASH_EQ,
|
anon_sym_DASH_EQ,
|
||||||
@ -20336,7 +20336,7 @@ static const uint16_t ts_small_parse_table[] = {
|
|||||||
ACTIONS(232), 1,
|
ACTIONS(232), 1,
|
||||||
anon_sym_LT,
|
anon_sym_LT,
|
||||||
STATE(421), 1,
|
STATE(421), 1,
|
||||||
sym_type_definition,
|
sym_type_specification,
|
||||||
ACTIONS(224), 2,
|
ACTIONS(224), 2,
|
||||||
anon_sym_DASH,
|
anon_sym_DASH,
|
||||||
anon_sym_GT,
|
anon_sym_GT,
|
||||||
@ -21532,7 +21532,7 @@ static const uint16_t ts_small_parse_table[] = {
|
|||||||
ACTIONS(827), 1,
|
ACTIONS(827), 1,
|
||||||
anon_sym_LT,
|
anon_sym_LT,
|
||||||
STATE(480), 1,
|
STATE(480), 1,
|
||||||
sym_type_definition,
|
sym_type_specification,
|
||||||
[18949] = 4,
|
[18949] = 4,
|
||||||
ACTIONS(3), 1,
|
ACTIONS(3), 1,
|
||||||
sym__comment,
|
sym__comment,
|
||||||
@ -21594,7 +21594,7 @@ static const uint16_t ts_small_parse_table[] = {
|
|||||||
ACTIONS(848), 1,
|
ACTIONS(848), 1,
|
||||||
anon_sym_EQ,
|
anon_sym_EQ,
|
||||||
STATE(453), 1,
|
STATE(453), 1,
|
||||||
sym_type_definition,
|
sym_type_specification,
|
||||||
[19038] = 4,
|
[19038] = 4,
|
||||||
ACTIONS(3), 1,
|
ACTIONS(3), 1,
|
||||||
sym__comment,
|
sym__comment,
|
||||||
@ -21791,7 +21791,7 @@ static const uint16_t ts_small_parse_table[] = {
|
|||||||
ACTIONS(890), 1,
|
ACTIONS(890), 1,
|
||||||
anon_sym_EQ,
|
anon_sym_EQ,
|
||||||
STATE(431), 1,
|
STATE(431), 1,
|
||||||
sym_type_definition,
|
sym_type_specification,
|
||||||
[19322] = 4,
|
[19322] = 4,
|
||||||
ACTIONS(3), 1,
|
ACTIONS(3), 1,
|
||||||
sym__comment,
|
sym__comment,
|
||||||
@ -21885,14 +21885,14 @@ static const uint16_t ts_small_parse_table[] = {
|
|||||||
ACTIONS(827), 1,
|
ACTIONS(827), 1,
|
||||||
anon_sym_LT,
|
anon_sym_LT,
|
||||||
STATE(421), 1,
|
STATE(421), 1,
|
||||||
sym_type_definition,
|
sym_type_specification,
|
||||||
[19455] = 3,
|
[19455] = 3,
|
||||||
ACTIONS(3), 1,
|
ACTIONS(3), 1,
|
||||||
sym__comment,
|
sym__comment,
|
||||||
ACTIONS(827), 1,
|
ACTIONS(827), 1,
|
||||||
anon_sym_LT,
|
anon_sym_LT,
|
||||||
STATE(405), 1,
|
STATE(405), 1,
|
||||||
sym_type_definition,
|
sym_type_specification,
|
||||||
[19465] = 3,
|
[19465] = 3,
|
||||||
ACTIONS(3), 1,
|
ACTIONS(3), 1,
|
||||||
sym__comment,
|
sym__comment,
|
||||||
@ -21906,7 +21906,7 @@ static const uint16_t ts_small_parse_table[] = {
|
|||||||
ACTIONS(827), 1,
|
ACTIONS(827), 1,
|
||||||
anon_sym_LT,
|
anon_sym_LT,
|
||||||
STATE(427), 1,
|
STATE(427), 1,
|
||||||
sym_type_definition,
|
sym_type_specification,
|
||||||
[19485] = 2,
|
[19485] = 2,
|
||||||
ACTIONS(3), 1,
|
ACTIONS(3), 1,
|
||||||
sym__comment,
|
sym__comment,
|
||||||
@ -21933,7 +21933,7 @@ static const uint16_t ts_small_parse_table[] = {
|
|||||||
ACTIONS(827), 1,
|
ACTIONS(827), 1,
|
||||||
anon_sym_LT,
|
anon_sym_LT,
|
||||||
STATE(407), 1,
|
STATE(407), 1,
|
||||||
sym_type_definition,
|
sym_type_specification,
|
||||||
[19523] = 2,
|
[19523] = 2,
|
||||||
ACTIONS(3), 1,
|
ACTIONS(3), 1,
|
||||||
sym__comment,
|
sym__comment,
|
||||||
@ -21958,7 +21958,7 @@ static const uint16_t ts_small_parse_table[] = {
|
|||||||
ACTIONS(827), 1,
|
ACTIONS(827), 1,
|
||||||
anon_sym_LT,
|
anon_sym_LT,
|
||||||
STATE(429), 1,
|
STATE(429), 1,
|
||||||
sym_type_definition,
|
sym_type_specification,
|
||||||
[19557] = 2,
|
[19557] = 2,
|
||||||
ACTIONS(3), 1,
|
ACTIONS(3), 1,
|
||||||
sym__comment,
|
sym__comment,
|
||||||
@ -21971,14 +21971,14 @@ static const uint16_t ts_small_parse_table[] = {
|
|||||||
ACTIONS(827), 1,
|
ACTIONS(827), 1,
|
||||||
anon_sym_LT,
|
anon_sym_LT,
|
||||||
STATE(399), 1,
|
STATE(399), 1,
|
||||||
sym_type_definition,
|
sym_type_specification,
|
||||||
[19575] = 3,
|
[19575] = 3,
|
||||||
ACTIONS(3), 1,
|
ACTIONS(3), 1,
|
||||||
sym__comment,
|
sym__comment,
|
||||||
ACTIONS(827), 1,
|
ACTIONS(827), 1,
|
||||||
anon_sym_LT,
|
anon_sym_LT,
|
||||||
STATE(408), 1,
|
STATE(408), 1,
|
||||||
sym_type_definition,
|
sym_type_specification,
|
||||||
[19585] = 3,
|
[19585] = 3,
|
||||||
ACTIONS(3), 1,
|
ACTIONS(3), 1,
|
||||||
sym__comment,
|
sym__comment,
|
||||||
@ -23019,8 +23019,8 @@ static const TSParseActionEntry ts_parse_actions[] = {
|
|||||||
[809] = {.entry = {.count = 1, .reusable = true}}, SHIFT(287),
|
[809] = {.entry = {.count = 1, .reusable = true}}, SHIFT(287),
|
||||||
[811] = {.entry = {.count = 1, .reusable = false}}, REDUCE(aux_sym_type_repeat1, 2),
|
[811] = {.entry = {.count = 1, .reusable = false}}, REDUCE(aux_sym_type_repeat1, 2),
|
||||||
[813] = {.entry = {.count = 1, .reusable = false}}, SHIFT(425),
|
[813] = {.entry = {.count = 1, .reusable = false}}, SHIFT(425),
|
||||||
[815] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_type_definition, 3),
|
[815] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_type_specification, 3),
|
||||||
[817] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_type_definition, 3),
|
[817] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_type_specification, 3),
|
||||||
[819] = {.entry = {.count = 1, .reusable = true}}, SHIFT(27),
|
[819] = {.entry = {.count = 1, .reusable = true}}, SHIFT(27),
|
||||||
[821] = {.entry = {.count = 1, .reusable = true}}, SHIFT(395),
|
[821] = {.entry = {.count = 1, .reusable = true}}, SHIFT(395),
|
||||||
[823] = {.entry = {.count = 1, .reusable = true}}, SHIFT(86),
|
[823] = {.entry = {.count = 1, .reusable = true}}, SHIFT(86),
|
||||||
|
Loading…
Reference in New Issue
Block a user