MCPcopy Index your code
hub / github.com/endbasic/endbasic / as_source

Method as_source

core/src/mem.rs:147–166  ·  view source on GitHub ↗

Formats this value as EndBASIC source code.

(&self)

Source from the content-addressed store, hash-verified

145
146 /// Formats this value as EndBASIC source code.
147 pub fn as_source(&self) -> String {
148 match self {
149 Self::Boolean(v) => {
150 if *v {
151 "TRUE".to_owned()
152 } else {
153 "FALSE".to_owned()
154 }
155 }
156 Self::Double(v) => {
157 let mut s = format!("{}", v);
158 if !s.contains('.') && !s.contains('e') && !s.contains('E') {
159 s.push_str(".0");
160 }
161 s
162 }
163 Self::Integer(v) => format!("{}", v),
164 Self::Text(v) => format!("\"{}\"", v.replace('"', "\"\"")),
165 }
166 }
167
168 /// Formats this value for display in disassembly output.
169 pub(crate) fn as_disassembly(&self) -> String {

Callers 1

check_expr_ok_with_varsFunction · 0.80

Calls 1

push_strMethod · 0.80

Tested by 1

check_expr_ok_with_varsFunction · 0.64