Crates.io | compose_parser |
lib.rs | compose_parser |
version | 2.1.0 |
source | src |
created_at | 2023-11-07 16:10:15.782522 |
updated_at | 2023-11-14 14:10:34.131502 |
description | Rust parser created to parse the Jetpack Compose Text and Images |
homepage | https://github.com/NaUKMA-Programistich/compose_parser |
repository | |
max_upload_size | |
id | 1028197 |
size | 30,182 |
Link: https://crates.io/crates/compose_parser Docs: https://docs.rs/compose_parser/latest/compose_parser/
compose_function = { function_declaration }
function_declaration = { "@Composable\nfun " ~ function_name ~ "() " ~ block }
function_name = { identifier }
block = { "{\n" ~ statement* ~ "}" }
statement = { text_function | image_function }
text_function = { " Text(text = " ~ string ~ ")\n" }
image_function = { " Image(image = " ~ string_image ~ ")\n" }
string = { "\"" ~ (ASCII_ALPHANUMERIC | " ")* ~ "\"" }
string_image = { "\"" ~ ASCII_ALPHANUMERIC* ~ ".png\"" }
identifier = { ASCII_ALPHA ~ (ASCII_ALPHANUMERIC | "_")* }
./compose_parser -h or --help # show help
./compose_parser --file <path> # parse file (example.txt)
./compose_parser --author # show author
./compose_parser without any arguments # show help
./compose_parser --file example.kt
@Composable
fun Example() {
Text(text = "World")
Image(image = "url.png")
Image(image = "image.png")
}
// In result you have function name and text and image fields
Function: Example
Text: World
Image: url.png
Image: image.png