X3ND1 GANTENG
Server IP : 108.163.255.210  /  Your IP : 13.59.35.116
Web Server : Apache
System : Linux blossom.urlnameserver.com 3.10.0-1160.80.1.el7.x86_64 #1 SMP Tue Nov 8 15:48:59 UTC 2022 x86_64
User :  ( 1172)
PHP Version : 7.2.34
Disable Function : eval,escapeshellarg,proc_close,proc_get_status,proc_nice,proc_open,symlink,system,pcntl_exec,getrusage,chown,chgp,closelog,openlog,syslog,define_syslog_variables,php_ini_loaded_file,getservbyname,getservbyport,posix_getgid,posix_getgrgid,proc_terminate,pfsockopen,apache_child_terminate,posix_mkfifo,posix_setpgid,posix_setuid,hypot,pg_host,pos,posix_access,posix_getcwd,posix_getservbyname,myshellexec,getpid,posix_getsid,posix_isatty,posix_kill,posix_mknod,posix_setgid,posix_setsid,posix_setuid,posix_times,posix_uname,ps_fill,posix_getpwuid,global,ini_restore,zip_open,zip_read,rar_open,bzopen,bzread,bzwrite,apache_get_modules,apache_get_version,phpversionphpinfo,php_ini_scanned_files,get_current_user,disk_total_space,diskfreespace,leak,imap_list,hypo,filedump,safe_mode,getmygid,apache_getenv,apache_setenv,bzread,bzwrite,bzopen,phpini,higlight_file,dos_conv,get_cwd,er_log,cmd,e_name,vdir,get_dir,only_read,ftok,ftpexec,posix_getpwnam,mysql_list_dbs,disk_free_space,session_save_path,confirm_phpdoc_compiled,zip_entry_rea,php_u,psockopen,crack_opendict,crack_getlastmessage,crack_closedict,crack_check,fpassthru,posix_get_last_error,posix_getlogin,posix_getgroups,posix_strerror,posix_getrlimit,posix_getpgrp,posix_getgrnam,pos,dl
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /home/unilinki/public_html/unilinkindia.com/old/node_modules/fastparse/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ BERANDA ]     

Current File : /home/unilinki/public_html/unilinkindia.com/old/node_modules/fastparse/README.md
# fastparse

A very simple and stupid parser, based on a statemachine and regular expressions.

It's not intended for complex languages. It's intended to easily write a simple parser for a simple language.



## Usage

Pass a description of statemachine to the constructor. The description must be in this form:

``` javascript
new Parser(description)

description is {
	// The key is the name of the state
	// The value is an object containing possible transitions
	"state-name": {
		// The key is a regular expression
		// If the regular expression matches the transition is executed
		// The value can be "true", a other state name or a function

		"a": true,
		// true will make the parser stay in the current state
		
		"b": "other-state-name",
		// a string will make the parser transit to a new state
		
		"[cde]": function(match, index, matchLength) {
			// "match" will be the matched string
			// "index" will be the position in the complete string
			// "matchLength" will be "match.length"
			
			// "this" will be the "context" passed to the "parse" method"
			
			// A new state name (string) can be returned
			return "other-state-name";
		},
		
		"([0-9]+)(\\.[0-9]+)?": function(match, first, second, index, matchLength) {
			// groups can be used in the regular expression
			// they will match to arguments "first", "second"
		},
		
		// the parser stops when it cannot match the string anymore
		
		// order of keys is the order in which regular expressions are matched
		// if the javascript runtime preserves the order of keys in an object
		// (this is not standardized, but it's a de-facto standard)
	}
}
```

The statemachine is compiled down to a single regular expression per state. So basically the parsing work is delegated to the (native) regular expression logic of the javascript runtime.


``` javascript
Parser.prototype.parse(initialState: String, parsedString: String, context: Object)
```

`initialState`: state where the parser starts to parse.

`parsedString`: the string which should be parsed.

`context`: an object which can be used to save state and results. Available as `this` in transition functions.

returns `context`




## Example

``` javascript
var Parser = require("fastparse");

// A simple parser that extracts @licence ... from comments in a JS file
var parser = new Parser({
	// The "source" state
	"source": {
		// matches comment start
		"/\\*": "comment",
		"//": "linecomment",
		
		// this would be necessary for a complex language like JS
		// but omitted here for simplicity
		// "\"": "string1",
		// "\'": "string2",
		// "\/": "regexp"
		
	},
	// The "comment" state
	"comment": {
		"\\*/": "source",
		"@licen[cs]e\\s((?:[^*\n]|\\*+[^*/\n])*)": function(match, licenseText) {
			this.licences.push(licenseText.trim());
		}
	},
	// The "linecomment" state
	"linecomment": {
		"\n": "source",
		"@licen[cs]e\\s(.*)": function(match, licenseText) {
			this.licences.push(licenseText.trim());
		}
	}
});

var licences = parser.parse("source", sourceCode, { licences: [] }).licences;

console.log(licences);
```



## License

MIT (http://www.opensource.org/licenses/mit-license.php)

Anon7 - 2022
SCDN GOK