grammar,compiler: Add Support For Fixed-Width Integers
Distinguishing between signed and unsigned fixed-width integer types must still be done. Signed-off-by: Will Hawkins <hawkinsw@obs.cr>
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
|
||||
import Common
|
||||
import P4Lang
|
||||
import P4Protos
|
||||
|
||||
public struct Generated {
|
||||
let gen: String
|
||||
@@ -48,13 +49,12 @@ public struct CodeGenerator: LanguageVisitor {
|
||||
return visitor.start(node, context: generated)
|
||||
}
|
||||
|
||||
/// TODO: Can we generate these implementations somehow?
|
||||
|
||||
public typealias Context = Generated
|
||||
|
||||
public func visit(
|
||||
_ v: Program, _ c: VisitorContext<Generated>
|
||||
) -> Result<VisitorContext<Generated>> {
|
||||
|
||||
var result: Result<VisitorContext<Generated>> = Fold(
|
||||
input: v.types, initial: .Ok(c.next(uc: c.getUserContext().append("[")))
|
||||
) { (current, acc) in
|
||||
|
||||
Reference in New Issue
Block a user