Skip to content

Commit

Permalink
chore: no_std version
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-orlovsky committed Nov 11, 2024
1 parent 4b769a3 commit 9dae6ef
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
strategy:
fail-fast: false
matrix:
feature: [ ]
feature: [ std ]
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
Expand Down
8 changes: 5 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ description = "Framework for declarative domain-specific languages"
repository = "https://github.com/UBIDECO/parseltongue"
homepage = "https://ubideco.org/ParselTongue"
keywords = ["language", "declarative", "syntax", "parser"]
categories = ["parser-implementations"]
categories = ["parser-implementations", "no-std"]
readme = "README.md"
license = "Apache-2.0"
edition = "2021"
Expand All @@ -20,8 +20,10 @@ name = "parseltongue"
amplify = "~4.8.0"

[features]
default = []
all = []
default = ["std"]
all = ["std"]

std = []

[package.metadata.docs.rs]
features = ["all"]
5 changes: 5 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,16 @@
// the License.

#![cfg_attr(docsrs, feature(doc_auto_cfg))]
#![cfg_attr(not(feature = "std"), no_std)]

#[cfg(not(feature = "std"))]
extern crate alloc;

#[macro_use]
extern crate amplify;

mod statement;
mod parser;

pub use parser::{Block, Brackets, ParseError, ParsedSource, Parser, Quotes, UnparsedSource};
pub use statement::{Decl, Module, Statement};
2 changes: 2 additions & 0 deletions src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
// or implied. See the License for the specific language governing permissions and limitations under
// the License.

#[cfg(not(feature = "std"))]
use alloc::vec::Vec;
use core::fmt::{self, Debug, Display, Formatter};
use core::str::Lines;

Expand Down

0 comments on commit 9dae6ef

Please sign in to comment.