Leeres Fossil Repo

Check-in [a4ec1e8a42]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Typos fixing
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:a4ec1e8a423a7d086cea2dc15a15f2647c3fdb93
User & Date: nsa 2013-04-08 13:00:45
Context
2013-04-09
03:02
Typofix check-in: adbe02bd31 user: nsa tags: trunk
2013-04-08
13:00
Typos fixing check-in: a4ec1e8a42 user: nsa tags: trunk
12:10
It finally works check-in: 2141176eb1 user: nsa tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to lit.go.w.

7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
..
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
I strongly recomend to read original Knuth paper on Literate Programming (http://www.literateprogramming.com/knuthweb.pdf)

Noweb.py by Jonathan Aquino was inspiration for this humble peace of code.

## Main idea
It was surprisingly easy to implement this tool. Main idea is to parse file in single pass line-by-line detecting 
chunks and use `Map` to store it's names and values. 
In second part of processing recursively 'expand' chunks bodies, replacing entries of others chunks to get full programm.

## Used packages
To process files this application using os, io, bufio and regex packages. Flag package used to parse command line parameters. It's a bit shitty, but it's ok.

<<Used packages>>=
	"regexp"
	"flag"
................................................................................
@

# Run flow
## Parsing command line parameters

Right after start application will try to parse command line parameters. If some vital data is not defined application will show usage and exit. 
There is 4 overall parameters: 
* --src-out: File name for code output (tangle output)
* --doc-out: File name for document output (weave output)
* --default-chunk: Default chunk name. Chunk with this name will consider holding main program code. By default it's name is "*"
* First parameter after all options witll consider file name to parse 

As I mention above, we using `flag` package to parse command line. For every command line argument there is variable defined. Default values for src-out and doc-out parameters is empty string.
In Go this is "Zero value" for string, so we can catch situation when user omit one or another parameter. Default value for default-chunk is always "*".

<<Command line parsing>>=
	var sourceFile string
	var docFile string
	var parsingFile string
	var defaultChunk string








|







 







|
|

|

|
|







7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
..
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
I strongly recomend to read original Knuth paper on Literate Programming (http://www.literateprogramming.com/knuthweb.pdf)

Noweb.py by Jonathan Aquino was inspiration for this humble peace of code.

## Main idea
It was surprisingly easy to implement this tool. Main idea is to parse file in single pass line-by-line detecting 
chunks and use `Map` to store it's names and values. 
In second part of processing recursively 'expand' chunks bodies, replacing entries of other chunks to get full programm.

## Used packages
To process files this application using os, io, bufio and regex packages. Flag package used to parse command line parameters. It's a bit shitty, but it's ok.

<<Used packages>>=
	"regexp"
	"flag"
................................................................................
@

# Run flow
## Parsing command line parameters

Right after start application will try to parse command line parameters. If some vital data is not defined application will show usage and exit. 
There is 4 overall parameters: 
* --src-out: File name for code output ("tangle" output)
* --doc-out: File name for document output ("weave" output)
* --default-chunk: Default chunk name. Chunk with this name will consider holding main program code. By default it's name is "*"
* First parameter after all options will be used as name of file to parse

As I mention above, we using `flag` package to parse command line. For every command line argument there is variable defined. Default values for src-out and doc-out parameters are empty strings.
In Go empty string is "zero value" for string, so we can catch situation when user omit one or another parameter. Default value for default-chunk is "*".

<<Command line parsing>>=
	var sourceFile string
	var docFile string
	var parsingFile string
	var defaultChunk string