documentation: Update Note Protocol
Using /// rather than simply //. Signed-off-by: Will Hawkins <hawkinsw@obs.cr>
This commit is contained in:
@@ -93,7 +93,7 @@ While coding, it may be useful to leave ourselves notes. Every note is formatted
|
|||||||
|
|
||||||
|
|
||||||
```Swift
|
```Swift
|
||||||
// NOTE: note text
|
/// NOTE<: optional note text>
|
||||||
```
|
```
|
||||||
|
|
||||||
where `NOTE` can be:
|
where `NOTE` can be:
|
||||||
|
|||||||
@@ -611,7 +611,7 @@ public class P4ArrayValue: P4DataValue {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public func set(index: Int, to: P4Value) -> Result<P4ArrayValue> {
|
public func set(index: Int, to: P4Value) -> Result<P4ArrayValue> {
|
||||||
// TODO: Check for OOB
|
/// TODO: Check for OOB
|
||||||
var updated_values = self.value
|
var updated_values = self.value
|
||||||
updated_values[index] = to
|
updated_values[index] = to
|
||||||
return Result.Ok(P4ArrayValue(withType: self.vtype, withValue: updated_values))
|
return Result.Ok(P4ArrayValue(withType: self.vtype, withValue: updated_values))
|
||||||
@@ -621,7 +621,7 @@ public class P4ArrayValue: P4DataValue {
|
|||||||
guard rhs as? P4ArrayValue != nil else {
|
guard rhs as? P4ArrayValue != nil else {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
// TODO!!
|
/// TODO
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -629,7 +629,7 @@ public class P4ArrayValue: P4DataValue {
|
|||||||
guard rhs as? P4ArrayValue != nil else {
|
guard rhs as? P4ArrayValue != nil else {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
// TODO!!
|
/// TODO
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -637,7 +637,7 @@ public class P4ArrayValue: P4DataValue {
|
|||||||
guard rhs as? P4ArrayValue != nil else {
|
guard rhs as? P4ArrayValue != nil else {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
// TODO!!
|
/// TODO
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -645,7 +645,7 @@ public class P4ArrayValue: P4DataValue {
|
|||||||
guard rhs as? P4ArrayValue != nil else {
|
guard rhs as? P4ArrayValue != nil else {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
// TODO!!
|
/// TODO
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -653,7 +653,7 @@ public class P4ArrayValue: P4DataValue {
|
|||||||
guard rhs as? P4ArrayValue != nil else {
|
guard rhs as? P4ArrayValue != nil else {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
// TODO!!
|
/// TODO
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -204,7 +204,7 @@ public struct P4Value: CustomStringConvertible {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public func update(withNewValue value: P4DataValue) -> Result<P4Value> {
|
public func update(withNewValue value: P4DataValue) -> Result<P4Value> {
|
||||||
// TODO: Check that the types match.
|
/// TODO: Check that the types match.
|
||||||
return .Ok(P4Value(value, self._type))
|
return .Ok(P4Value(value, self._type))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ extension Declaration: CompilableDeclaration {
|
|||||||
let declaration_compilers: [String: CompilableDeclaration.Type] = [
|
let declaration_compilers: [String: CompilableDeclaration.Type] = [
|
||||||
"function_declaration": FunctionDeclaration.self,
|
"function_declaration": FunctionDeclaration.self,
|
||||||
"control_declaration": Control.self,
|
"control_declaration": Control.self,
|
||||||
"type_declaration": P4Struct.self, // ASSUME: Type declarations are struct declarations.
|
"type_declaration": P4Struct.self, /// ASSUME: Type declarations are struct declarations.
|
||||||
"extern_declaration": ExternDeclaration.self,
|
"extern_declaration": ExternDeclaration.self,
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -273,7 +273,7 @@ extension P4Lang.Parser: CompilableDeclaration {
|
|||||||
let type_node = current_node
|
let type_node = current_node
|
||||||
var parser_name: Common.Identifier? = .none
|
var parser_name: Common.Identifier? = .none
|
||||||
|
|
||||||
// TODO: Handle parser parameter lists.
|
/// TODO: Handle parser parameter lists.
|
||||||
var parameter_list = ParameterList()
|
var parameter_list = ParameterList()
|
||||||
|
|
||||||
do {
|
do {
|
||||||
|
|||||||
@@ -352,7 +352,7 @@ extension BinaryOperatorExpression: CompilableExpression {
|
|||||||
ErrorOnNode(
|
ErrorOnNode(
|
||||||
node: node, withError: "Malformed binary operator expression")))
|
node: node, withError: "Malformed binary operator expression")))
|
||||||
|
|
||||||
// TODO: This macro cannot handle new lines in the arrays
|
/// TODO: This macro cannot handle new lines in the arrays
|
||||||
// swift-format-ignore
|
// swift-format-ignore
|
||||||
#RequireNodesType<Node, EvaluatableExpression?>(
|
#RequireNodesType<Node, EvaluatableExpression?>(
|
||||||
nodes: binary_operator_expression_node,
|
nodes: binary_operator_expression_node,
|
||||||
|
|||||||
@@ -275,7 +275,7 @@ public struct Parser {
|
|||||||
var error: Error? = .none
|
var error: Error? = .none
|
||||||
|
|
||||||
var current_context = context
|
var current_context = context
|
||||||
// TODO: Assert that there is only one.
|
/// TODO: Assert that there is only one.
|
||||||
node.enumerateNamedChildren { parser_state in
|
node.enumerateNamedChildren { parser_state in
|
||||||
if parser_state.nodeType != "parserState" {
|
if parser_state.nodeType != "parserState" {
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ public struct Declaration: P4DataType {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public func def() -> any Common.P4DataValue {
|
public func def() -> any Common.P4DataValue {
|
||||||
// TODO: Is a default of the extern'd type the right way to go?
|
/// TODO: Is a default of the extern'd type the right way to go?
|
||||||
return self.identifier.type.dataType().def()
|
return self.identifier.type.dataType().def()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -141,7 +141,7 @@ public struct FunctionCall {
|
|||||||
public init(_ callee: P4FFI, withArguments arguments: ArgumentList) {
|
public init(_ callee: P4FFI, withArguments arguments: ArgumentList) {
|
||||||
self.callee = (.none, callee)
|
self.callee = (.none, callee)
|
||||||
self.arguments = arguments
|
self.arguments = arguments
|
||||||
// ASSUME: That the FFI has been checked and the type is always a function declaration.
|
/// ASSUME: That the FFI has been checked and the type is always a function declaration.
|
||||||
self.return_type = (callee.type().dataType() as! FunctionDeclaration).tipe.dataType()
|
self.return_type = (callee.type().dataType() as! FunctionDeclaration).tipe.dataType()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -367,7 +367,7 @@ extension FieldAccessExpression: EvaluatableExpression {
|
|||||||
return (.Error(Error(withMessage: "\(strct) does not identify a struct")), updated_execution)
|
return (.Error(Error(withMessage: "\(strct) does not identify a struct")), updated_execution)
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Create a default value?
|
/// TODO: Create a default value?
|
||||||
guard let value = struct_strct.get(field: self.field) else {
|
guard let value = struct_strct.get(field: self.field) else {
|
||||||
return (.Error(Error(withMessage: "Missing value")), updated_execution)
|
return (.Error(Error(withMessage: "Missing value")), updated_execution)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user