Spicy
variable.h
1 // Copyright (c) 2020-2021 by the Zeek Project. See LICENSE for details.
2 
3 #pragma once
4 
5 #include <string>
6 #include <utility>
7 
8 #include <spicy/compiler/detail/codegen/production.h>
9 
11 
19 public:
20  Variable(const std::string& symbol, spicy::Type type, const Location& l = location::None)
21  : ProductionBase(symbol, l), _type(std::move(type)) {}
22 
23  spicy::Type type() const { return _type; }
24  bool nullable() const { return false; }
25  bool eodOk() const { return nullable(); }
26  bool atomic() const { return true; }
27  std::string render() const { return hilti::util::fmt("%s", _type); }
28 
29 private:
30  spicy::Type _type;
31 };
32 
33 } // namespace spicy::detail::codegen::production
const std::string & symbol() const
Definition: production.h:191
Definition: production.h:170
Definition: grammar.h:15
Definition: production.h:23
Definition: type.h:160
Definition: location.h:18
ProductionBase(std::string symbol, Location l=location::None)
Definition: production.h:181