nk
1.0.0
C++ Numerical Computing Runtime
Toggle main menu visibility
Loading...
Searching...
No Matches
lang.hpp
Go to the documentation of this file.
1
// src/builtin/include/nk/builtin/lang.hpp
2
//
3
// Pure C++ Language keywords, variable name validation, environment, and evaluation.
4
#pragma once
5
6
#include <memory_resource>
7
#include <string>
8
#include <vector>
9
#include <nk/value/value.hpp>
10
#include <nk/value/span.hpp>
11
12
namespace
nk::builtin {
13
16
17
24
25
#include <nk/fs/branding.hpp>
26
27
// ── Environment Variables ───────────────────────────────────────────────────
28
38
void
setenv
(
const
std::string &name,
const
std::string &value =
""
);
39
45
std::string
getenv
(
const
std::string &name);
46
53
Value
getenv
(
const
Value
&name, std::pmr::memory_resource *mr =
nullptr
);
54
55
// ── Keyword & Identifier Inspection ─────────────────────────────────────────
56
66
bool
iskeyword
(
const
std::string &name);
67
72
const
std::vector<std::string> &
keywords
();
73
83
Value
iskeyword
(
Span<const Value>
args, std::pmr::memory_resource *mr =
nullptr
);
84
93
bool
isvarname
(
const
std::string &name);
94
104
Value
isvarname
(
const
Value
&name, std::pmr::memory_resource *mr =
nullptr
);
105
112
Value
isvarname
(
Span<const Value>
args, std::pmr::memory_resource *mr =
nullptr
);
113
114
116
}
// namespace nk::builtin
nk::Span
Definition
span.hpp:11
nk::Value
Core MATLAB-compatible multidimensional array and scalar value type.
Definition
value.hpp:61
nk::builtin::getenv
std::string getenv(const std::string &name)
Reads an operating system environment variable as a C++ string (getenv(name)).
nk::builtin::keywords
const std::vector< std::string > & keywords()
Lists all reserved MATLAB keywords as a C++ vector.
nk::builtin::isvarname
bool isvarname(const std::string &name)
Tests whether a string is a valid MATLAB variable name (isvarname(s)).
nk::builtin::setenv
void setenv(const std::string &name, const std::string &value="")
Sets or clears an operating system environment variable (setenv(name, value)).
nk::builtin::iskeyword
bool iskeyword(const std::string &name)
Tests whether a string is a reserved MATLAB language keyword (iskeyword(s)).
src
builtin
include
nk
builtin
lang.hpp
Generated by
1.17.0