# nv-macro-lexblk

> nv-macro-lexblk ===================== - nv-macro-lexblk is a simple macro-tool, only one syntax - cli tool, use a simple syntax `##lexblk(...)` in your script - to let you get/set lexical-variables(let,var,params) from outside - to avoid using for/wh

Latest version **1.0.2** (published 2021-10-18) · ISC license · 0 weekly downloads

## Install

```sh
npm install nv-macro-lexblk
pnpm add nv-macro-lexblk
yarn add nv-macro-lexblk
bun add nv-macro-lexblk
```

Provides the command `nv_lexblk`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2021-10-18 |
| First published | 2021-10-18 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 6.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | ihgazni2 |
| Keywords | macro, for macro, block macro, reusable |

## Links

- npm: https://www.npmjs.com/package/nv-macro-lexblk
- npm.io page: https://npm.io/package/nv-macro-lexblk

## Dependencies (3)

- [@babel/core](https://npm.io/package/@babel/core.md) ^7.15.5
- [nv-js-parse](https://npm.io/package/nv-js-parse.md) ^1.0.33
- [nv-cli-basic](https://npm.io/package/nv-cli-basic.md) ^1.0.5

## Recent versions

- 1.0.2 (latest) — 2021-10-18

## README

nv-macro-lexblk
=====================
- nv-macro-lexblk is a simple macro-tool, only two syntax   
- cli tool
- use a simple syntax `##lexblk <blkname> <......>`  to define block in your script
- use `##<blkname>()` to insert it
- lex block is always treated as "global defined" when compile
- its slow, so only suited for pre-compile using

install
=======
- npm install nv-macro-lexblk -g 

usage
=====

        nv-macro-lexblk# node cli.js -h
        Usage: nv_lexblk [options]
        Options:
            -i, --input             input string ,default stdin
            -o, --output            output string,default stdout
            -c, --compile           compile the macro
            -m, --macro_name        `##${macro_name}` used in script,default is lexblk
            -h, --help              usage

        nv-macro-lexblk#
        nv-macro-lexblk#
        nv-macro-lexblk# node cli.js -M
            the default macro_name:  lexblk
            use it begin with two #:  ##lexblk(...)
        nv-macro-lexblk#
        nv-macro-lexblk#
        nv-macro-lexblk# node cli.js -S

            ......
                //define
                ##lexblk myfor for(let i=0;i<3;i++) { x= x+i}
                //use
                function tst1() {
                    let x =1;
                    ##myfor();
                    return(x)
                }
            .....

    
example
-------


###
        % nv_lexblk -c 

        ////the source code

        ////define blocks

        ##lexblk myfor for(let i=0;i<3;i++) {
            x = x +i
        }


        ##lexblk yourfor for(j=1;j<3;j++) {
            x = x *j
        }



        function tst1() {
            let x =1;
            ##myfor();                   //---use block
            ##yourfor();                 //---use block
            return(x)
        }
        function tst2() {
            let x =1;
            ##yourfor();                 //---use block
            ##myfor();                   //---use block
            return(x)
        }

        //-----PRESS  ctrl+D

        function tst1() {
          let x = 1;

          for (let i = 0; i < 3; i++) {
            x = x + i;
          }

          for (j = 1; j < 3; j++) {
            x = x * j;
          }

          return x;
        }

        function tst2() {
          let x = 1;

          for (j = 1; j < 3; j++) {
            x = x * j;
          }

          for (let i = 0; i < 3; i++) {
            x = x + i;
          }

          return x;
        }



LICENSE
=======
- ISC

---
_Source: https://npm.io/package/nv-macro-lexblk · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
