nv-cli-many-block
v1.0.0
Published
nv-cli-many-block =============== - nv-cli-many-block - cli tool, generate a template for many block - function | async-function | lambda | async-lambda - switch | if-elif-else | for | while | try-catch-finally | block
Downloads
2
Readme
nv-cli-many-block
- nv-cli-many-block
- cli tool, generate a template for many block
- function | async-function | lambda | async-lambda
- switch | if-elif-else | for | while | try-catch-finally | block
install
- npm install nv-cli-many-block -g
usage
Usage: nv_cli_mb [options]
Options:
-e, --expr expr to generate block
-h, --help usage
=========SIMPLE EXPR SYNTAX=============
{
KEYWORDS: {
f: 'function',
F: 'async function',
a: 'lambda',
A: 'async lambda',
s: 'switch',
i: 'if-<elif>*-else',
t: 'try-catch-<finally>?',
w: 'while',
o: 'for',
b: 'block'
},
OPER: [ '(', ')', '<repeat-number>' ],
WS: 'others-all-treated-as-white-space',
PRODUCTION: {
'<expr>': '<f>|<F>|<a>|<A>|<s>|<i>|<t>|<w>|<o>|<b>',
'<f>': 'f<repeat-number>?<(<expr>)>?',
'<F>': 'F<repeat-number>?<(<expr>)>?',
'<a>': 'a<repeat-number>?<(<expr>)>?',
'<A>': 'A<repeat-number>?<(<expr>)>?',
'<w>': 'w<repeat-number>?<(<expr>)>?',
'<o>': 'o<repeat-number>?<(<expr>)>?',
'<b>': 'b<repeat-number>?<(<expr>)>?',
'<t>': 't<repeat-number>?<(<expr>)>?<(<expr>)>?<(<expr>)>?',
'<s>': 's<repeat-number>?<(<expr>)>*',
'<i>': 'i<repeat-number>?<(<expr>)>*'
}
}
example
two-function AND two-while
#nv_cli_mb -e "f2 w2"
function /*fname-2*/(/*params-2*/) {
}
function /*fname-3*/(/*params-3*/) {
}
while(/*cond-4*/) {
}
while(/*cond-5*/) {
}
async-lambda IN async-function IN lambda IN function
# nv_cli_mb -e "f(a(F(A())))"
function /*fname-2*/(/*params-2*/) {
(/*params-3*/) => {
async function /*fname-4*/(/*params-4*/) {
async (/*params-5*/) => {
}
}
}
}
#
two-while-in-function AND the-function repeat two times
# nv_cli_mb -e "f2(w2)"
function /*fname-2*/(/*params-2*/) {
while(/*cond-3*/) {
}
while(/*cond-4*/) {
}
}
function /*fname-5*/(/*params-5*/) {
while(/*cond-6*/) {
}
while(/*cond-7*/) {
}
}
if AND 3-elif AND ELSE: total 1+3+1=5
# nv_cli_mb -e "i()5"
if(/*cond-3*/){
} else if(/*cond-4*/) {
} else if(/*cond-5*/) {
} else if(/*cond-6*/) {
} else {
}
(if AND 3-elif AND ELSE) repeat 2 times
# nv_cli_mb -e "i2()5"
if(/*cond-3*/){
} else if(/*cond-4*/) {
} else if(/*cond-5*/) {
} else if(/*cond-6*/) {
} else {
}
if(/*cond-9*/){
} else if(/*cond-10*/) {
} else if(/*cond-11*/) {
} else if(/*cond-12*/) {
} else {
}
(
(
(
(if AND 3-elif AND ELSE) repeat 2 times
) IN while
) repeat 2 times) IN function
) repeat 2 times
#nv_cli_mb -e "f2(w2(i2()5))"
function /*fname-2*/(/*params-2*/) {
while(/*cond-3*/) {
if(/*cond-5*/){
} else if(/*cond-6*/) {
} else if(/*cond-7*/) {
} else if(/*cond-8*/) {
} else {
}
if(/*cond-11*/){
} else if(/*cond-12*/) {
} else if(/*cond-13*/) {
} else if(/*cond-14*/) {
} else {
}
}
while(/*cond-16*/) {
if(/*cond-18*/){
} else if(/*cond-19*/) {
} else if(/*cond-20*/) {
} else if(/*cond-21*/) {
} else {
}
if(/*cond-24*/){
} else if(/*cond-25*/) {
} else if(/*cond-26*/) {
} else if(/*cond-27*/) {
} else {
}
}
}
function /*fname-29*/(/*params-29*/) {
while(/*cond-30*/) {
if(/*cond-32*/){
} else if(/*cond-33*/) {
} else if(/*cond-34*/) {
} else if(/*cond-35*/) {
} else {
}
if(/*cond-38*/){
} else if(/*cond-39*/) {
} else if(/*cond-40*/) {
} else if(/*cond-41*/) {
} else {
}
}
while(/*cond-43*/) {
if(/*cond-45*/){
} else if(/*cond-46*/) {
} else if(/*cond-47*/) {
} else if(/*cond-48*/) {
} else {
}
if(/*cond-51*/){
} else if(/*cond-52*/) {
} else if(/*cond-53*/) {
} else if(/*cond-54*/) {
} else {
}
}
}
try-catch
# nv_cli_mb -e "t"
try {
} catch(/*err-4*/) {
}
#
try-catch-finally
# nv_cli_mb -e "t()3"
try {
} catch(/*err-4*/) {
} finally {
}
# nv_cli_mb -e "t()()()"
try {
} catch(/*err-4*/) {
} finally {
}
switch WITH 3-cases AND 1-default: total 3+1=4
# nv_cli_mb -e "s()4"
switch(/*discriminant-2*/) {
case(/*case:test-3*/): {
}
case(/*case:test-4*/): {
}
case(/*case:test-5*/): {
}
default: {
}
}
(switch-of-3-cases IN if-consequence) AND (try-catch-finally IN else)
# nv_cli_mb -e "i(s()4)(t()()())"
if(/*cond-3*/){
switch(/*discriminant-4*/) {
case(/*case:test-5*/): {
}
case(/*case:test-6*/): {
}
case(/*case:test-7*/): {
}
default: {
}
}
} else {
try {
} catch(/*err-12*/) {
} finally {
}
}
#
two((two ((two for) IN while) ) IN for) IN while
#nv_cli_mb -e "w(o2(w2(o2())))"
while(/*cond-2*/) {
for(/*init-3*/ ;/*test-3*/ ;/*update-3*/ ) {
while(/*cond-4*/) {
for(/*init-5*/ ;/*test-5*/ ;/*update-5*/ ) {
}
for(/*init-6*/ ;/*test-6*/ ;/*update-6*/ ) {
}
}
while(/*cond-7*/) {
for(/*init-8*/ ;/*test-8*/ ;/*update-8*/ ) {
}
for(/*init-9*/ ;/*test-9*/ ;/*update-9*/ ) {
}
}
}
for(/*init-10*/ ;/*test-10*/ ;/*update-10*/ ) {
while(/*cond-11*/) {
for(/*init-12*/ ;/*test-12*/ ;/*update-12*/ ) {
}
for(/*init-13*/ ;/*test-13*/ ;/*update-13*/ ) {
}
}
while(/*cond-14*/) {
for(/*init-15*/ ;/*test-15*/ ;/*update-15*/ ) {
}
for(/*init-16*/ ;/*test-16*/ ;/*update-16*/ ) {
}
}
}
}
a complicate one
# nv_cli_mb -e "a2(i(w3)8 w6() t(o5)(s2)(a3))"
(/*params-2*/) => {
if(/*cond-4*/){
while(/*cond-5*/) {
}
while(/*cond-6*/) {
}
while(/*cond-7*/) {
}
} else if(/*cond-8*/) {
while(/*cond-9*/) {
}
while(/*cond-10*/) {
}
while(/*cond-11*/) {
}
} else if(/*cond-12*/) {
while(/*cond-13*/) {
}
while(/*cond-14*/) {
}
while(/*cond-15*/) {
}
} else if(/*cond-16*/) {
while(/*cond-17*/) {
}
while(/*cond-18*/) {
}
while(/*cond-19*/) {
}
} else if(/*cond-20*/) {
while(/*cond-21*/) {
}
while(/*cond-22*/) {
}
while(/*cond-23*/) {
}
} else if(/*cond-24*/) {
while(/*cond-25*/) {
}
while(/*cond-26*/) {
}
while(/*cond-27*/) {
}
} else if(/*cond-28*/) {
while(/*cond-29*/) {
}
while(/*cond-30*/) {
}
while(/*cond-31*/) {
}
} else {
while(/*cond-33*/) {
}
while(/*cond-34*/) {
}
while(/*cond-35*/) {
}
}
while(/*cond-36*/) {
}
while(/*cond-37*/) {
}
while(/*cond-38*/) {
}
while(/*cond-39*/) {
}
while(/*cond-40*/) {
}
while(/*cond-41*/) {
}
try {
for(/*init-44*/ ;/*test-44*/ ;/*update-44*/ ) {
}
for(/*init-45*/ ;/*test-45*/ ;/*update-45*/ ) {
}
for(/*init-46*/ ;/*test-46*/ ;/*update-46*/ ) {
}
for(/*init-47*/ ;/*test-47*/ ;/*update-47*/ ) {
}
for(/*init-48*/ ;/*test-48*/ ;/*update-48*/ ) {
}
} catch(/*err-49*/) {
switch(/*discriminant-50*/) {
default: {
}
}
switch(/*discriminant-52*/) {
default: {
}
}
} finally {
(/*params-55*/) => {
}
(/*params-56*/) => {
}
(/*params-57*/) => {
}
}
}
(/*params-58*/) => {
if(/*cond-60*/){
while(/*cond-61*/) {
}
while(/*cond-62*/) {
}
while(/*cond-63*/) {
}
} else if(/*cond-64*/) {
while(/*cond-65*/) {
}
while(/*cond-66*/) {
}
while(/*cond-67*/) {
}
} else if(/*cond-68*/) {
while(/*cond-69*/) {
}
while(/*cond-70*/) {
}
while(/*cond-71*/) {
}
} else if(/*cond-72*/) {
while(/*cond-73*/) {
}
while(/*cond-74*/) {
}
while(/*cond-75*/) {
}
} else if(/*cond-76*/) {
while(/*cond-77*/) {
}
while(/*cond-78*/) {
}
while(/*cond-79*/) {
}
} else if(/*cond-80*/) {
while(/*cond-81*/) {
}
while(/*cond-82*/) {
}
while(/*cond-83*/) {
}
} else if(/*cond-84*/) {
while(/*cond-85*/) {
}
while(/*cond-86*/) {
}
while(/*cond-87*/) {
}
} else {
while(/*cond-89*/) {
}
while(/*cond-90*/) {
}
while(/*cond-91*/) {
}
}
while(/*cond-92*/) {
}
while(/*cond-93*/) {
}
while(/*cond-94*/) {
}
while(/*cond-95*/) {
}
while(/*cond-96*/) {
}
while(/*cond-97*/) {
}
try {
for(/*init-100*/ ;/*test-100*/ ;/*update-100*/ ) {
}
for(/*init-101*/ ;/*test-101*/ ;/*update-101*/ ) {
}
for(/*init-102*/ ;/*test-102*/ ;/*update-102*/ ) {
}
for(/*init-103*/ ;/*test-103*/ ;/*update-103*/ ) {
}
for(/*init-104*/ ;/*test-104*/ ;/*update-104*/ ) {
}
} catch(/*err-105*/) {
switch(/*discriminant-106*/) {
default: {
}
}
switch(/*discriminant-108*/) {
default: {
}
}
} finally {
(/*params-111*/) => {
}
(/*params-112*/) => {
}
(/*params-113*/) => {
}
}
}
LICENSE
- ISC