Generate AST json files from applying babel/parse to recursive path exploration.
- @babel/parser
- ts-node
interface ITree{
name: string;
repr: string;
text: string;
children: ITree[];
isTerminal: boolean
}
-
local.ts file
//Typescript import extract from './extractor' extract(process.argv[2])
-
Run the script
npm run parse <PATH>
{
"name":"Program",
"children":[
{
"name":"VariableDeclaration",
"children":[
{
"name":"VariableDeclarator",
"children":[
{
"name":"Identifier",
"children":[
],
"isTerminal":true,
"text":"should",
"repr":"should"
},
{
"name":"CallExpression",
"children":[
{
"name":"Identifier",
"children":[
],
"isTerminal":true,
"text":"require",
"repr":"require"
},
{
"name":"StringLiteral",
"children":[
],
"isTerminal":true,
"text":"\"should\"",
"repr":"'should'"
}
],
"isTerminal":false,
"text":"",
"repr":""
}
],
"isTerminal":false,
"text":"",
"repr":""
}
],
"isTerminal":false,
"text":"",
"repr":""
},
{
"name":"VariableDeclaration",
"children":[
{
"name":"VariableDeclarator",
"children":[
{
"name":"Identifier",
"children":[
],
"isTerminal":true,
"text":"Packet",
"repr":"Packet"
},
{
"name":"CallExpression",
"children":[
{
"name":"Identifier",
"children":[
],
"isTerminal":true,
"text":"require",
"repr":"require"
},
{
"name":"StringLiteral",
"children":[
],
"isTerminal":true,
"text":"\"../../network/packet\"",
"repr":"'../../network/packet'"
}
],
"isTerminal":false,
"text":"",
"repr":""
}
],
"isTerminal":false,
"text":"",
"repr":""
}
],
"isTerminal":false,
"text":"",
"repr":""
},
{
"name":"ExpressionStatement",
"children":[
{
"name":"CallExpression",
"children":[
{
"name":"Identifier",
"children":[
],
"isTerminal":true,
"text":"describe",
"repr":"describe"
},
{
"name":"StringLiteral",
"children":[
],
"isTerminal":true,
"text":"\"Packet\"",
"repr":"'Packet'"
},
{
"name":"FunctionExpression",
"children":[
{
"name":"BlockStatement",
"children":[
{
"name":"VariableDeclaration",
"children":[
{
"name":"VariableDeclarator",
"children":[
{
"name":"Identifier",
"children":[
],
"isTerminal":true,
"text":"packet",
"repr":"packet"
}
],
"isTerminal":false,
"text":"",
"repr":""
}
],
"isTerminal":false,
"text":"",
"repr":""
},
{
"name":"ExpressionStatement",
"children":[
{
"name":"CallExpression",
"children":[
{
"name":"Identifier",
"children":[
],
"isTerminal":true,
"text":"beforeEach",
"repr":"beforeEach"
},
{
"name":"FunctionExpression",
"children":[
{
"name":"BlockStatement",
"children":[
{
"name":"ExpressionStatement",
"children":[
{
"name":"AssignmentExpression",
"children":[
{
"name":"Identifier",
"children":[
],
"isTerminal":true,
"text":"packet",
"repr":"packet"
},
{
"name":"NewExpression",
"children":[
{
"name":"Identifier",
"children":[
],
"isTerminal":true,
"text":"Packet",
"repr":"Packet"
},
{
"name":"NumericLiteral",
"children":[
],
"isTerminal":true,
"text":"10",
"repr":"10"
}
],
"isTerminal":false,
"text":"",
"repr":""
}
],
"isTerminal":false,
"text":"",
"repr":""
}
],
"isTerminal":false,
"text":"",
"repr":""
}
],
"isTerminal":false,
"text":"",
"repr":""
}
],
"isTerminal":false,
"text":"",
"repr":""
}
],
"isTerminal":false,
"text":"",
"repr":""
}
],
"isTerminal":false,
"text":"",
"repr":""
},
{
"name":"ExpressionStatement",
"children":[
{
"name":"CallExpression",
"children":[
{
"name":"Identifier",
"children":[
],
"isTerminal":true,
"text":"describe",
"repr":"describe"
},
{
"name":"StringLiteral",
"children":[
],
"isTerminal":true,
"text":"\"#Packet()\"",
"repr":"'#Packet()'"
},
{
"name":"FunctionExpression",
"children":[
{
"name":"BlockStatement",
"children":[
{
"name":"ExpressionStatement",
"children":[
{
"name":"CallExpression",
"children":[
{
"name":"Identifier",
"children":[
],
"isTerminal":true,
"text":"it",
"repr":"it"
},
{
"name":"StringLiteral",
"children":[
],
"isTerminal":true,
"text":"\"should create a new buffer matching the size passed in\"",
"repr":"'should create a new buffer matching the size passed in'"
},
{
"name":"FunctionExpression",
"children":[
{
"name":"BlockStatement",
"children":[
{
"name":"ExpressionStatement",
"children":[
{
"name":"CallExpression",
"children":[
{
"name":"MemberExpression",
"children":[
{
"name":"MemberExpression",
"children":[
{
"name":"MemberExpression",
"children":[
{
"name":"MemberExpression",
"children":[
{
"name":"Identifier",
"children":[
],
"isTerminal":true,
"text":"packet",
"repr":"packet"
},
{
"name":"Identifier",
"children":[
],
"isTerminal":true,
"text":"buffer",
"repr":"buffer"
}
],
"isTerminal":false,
"text":"",
"repr":""
},
{
"name":"Identifier",
"children":[
],
"isTerminal":true,
"text":"length",
"repr":"length"
}
],
"isTerminal":false,
"text":"",
"repr":""
},
{
"name":"Identifier",
"children":[
],
"isTerminal":true,
"text":"should",
"repr":"should"
}
],
"isTerminal":false,
"text":"",
"repr":""
},
{
"name":"Identifier",
"children":[
],
"isTerminal":true,
"text":"equal",
"repr":"equal"
}
],
"isTerminal":false,
"text":"",
"repr":""
},
{
"name":"NumericLiteral",
"children":[
],
"isTerminal":true,
"text":"10",
"repr":"10"
}
],
"isTerminal":false,
"text":"",
"repr":""
}
],
"isTerminal":false,
"text":"",
"repr":""
}
],
"isTerminal":false,
"text":"",
"repr":""
}
],
"isTerminal":false,
"text":"",
"repr":""
}
],
"isTerminal":false,
"text":"",
"repr":""
}
],
"isTerminal":false,
"text":"",
"repr":""
},
{
"name":"ExpressionStatement",
"children":[
{
"name":"CallExpression",
"children":[
{
"name":"Identifier",
"children":[
],
"isTerminal":true,
"text":"it",
"repr":"it"
},
{
"name":"StringLiteral",
"children":[
],
"isTerminal":true,
"text":"\"should set cursor to zero\"",
"repr":"'should set cursor to zero'"
},
{
"name":"FunctionExpression",
"children":[
{
"name":"BlockStatement",
"children":[
{
"name":"ExpressionStatement",
"children":[
{
"name":"CallExpression",
"children":[
{
"name":"MemberExpression",
"children":[
{
"name":"MemberExpression",
"children":[
{
"name":"MemberExpression",
"children":[
{
"name":"Identifier",
"children":[
],
"isTerminal":true,
"text":"packet",
"repr":"packet"
},
{
"name":"Identifier",
"children":[
],
"isTerminal":true,
"text":"cursor",
"repr":"cursor"
}
],
"isTerminal":false,
"text":"",
"repr":""
},
{
"name":"Identifier",
"children":[
],
"isTerminal":true,
"text":"should",
"repr":"should"
}
],
"isTerminal":false,
"text":"",
"repr":""
},
{
"name":"Identifier",
"children":[
],
"isTerminal":true,
"text":"equal",
"repr":"equal"
}
],
"isTerminal":false,
"text":"",
"repr":""
},
{
"name":"NumericLiteral",
"children":[
],
"isTerminal":true,
"text":"0",
"repr":"0"
}
],
"isTerminal":false,
"text":"",
"repr":""
}
],
"isTerminal":false,
"text":"",
"repr":""
}
],
"isTerminal":false,
"text":"",
"repr":""
}
],
"isTerminal":false,
"text":"",
"repr":""
}
],
"isTerminal":false,
"text":"",
"repr":""
}
],
"isTerminal":false,
"text":"",
"repr":""
}
],
"isTerminal":false,
"text":"",
"repr":""
}
],
"isTerminal":false,
"text":"",
"repr":""
}
],
"isTerminal":false,
"text":"",
"repr":""
}
],
"isTerminal":false,
"text":"",
"repr":""
},
{
"name":"ExpressionStatement",
"children":[
{
"name":"CallExpression",
"children":[
{
"name":"Identifier",
"children":[
],
"isTerminal":true,
"text":"describe",
"repr":"describe"
},
{
"name":"StringLiteral",
"children":[
],
"isTerminal":true,
"text":"\"#result()\"",
"repr":"'#result()'"
},
{
"name":"FunctionExpression",
"children":[
{
"name":"BlockStatement",
"children":[
{
"name":"ExpressionStatement",
"children":[
{
"name":"CallExpression",
"children":[
{
"name":"Identifier",
"children":[
],
"isTerminal":true,
"text":"it",
"repr":"it"
},
{
"name":"StringLiteral",
"children":[
],
"isTerminal":true,
"text":"\"should return the buffer\"",
"repr":"'should return the buffer'"
},
{
"name":"FunctionExpression",
"children":[
{
"name":"BlockStatement",
"children":[
{
"name":"ExpressionStatement",
"children":[
{
"name":"CallExpression",
"children":[
{
"name":"MemberExpression",
"children":[
{
"name":"MemberExpression",
"children":[
{
"name":"CallExpression",
"children":[
{
"name":"MemberExpression",
"children":[
{
"name":"Identifier",
"children":[
],
"isTerminal":true,
"text":"packet",
"repr":"packet"
},
{
"name":"Identifier",
"children":[
],
"isTerminal":true,
"text":"result",
"repr":"result"
}
],
"isTerminal":false,
"text":"",
"repr":""
}
],
"isTerminal":false,
"text":"",
"repr":""
},
{
"name":"Identifier",
"children":[
],
"isTerminal":true,
"text":"should",
"repr":"should"
}
],
"isTerminal":false,
"text":"",
"repr":""
},
{
"name":"Identifier",
"children":[
],
"isTerminal":true,
"text":"equal",
"repr":"equal"
}
],
"isTerminal":false,
"text":"",
"repr":""
},
{
"name":"MemberExpression",
"children":[
{
"name":"Identifier",
"children":[
],
"isTerminal":true,
"text":"packet",
"repr":"packet"
},
{
"name":"Identifier",
"children":[
],
"isTerminal":true,
"text":"buffer",
"repr":"buffer"
}
],
"isTerminal":false,
"text":"",
"repr":""
}
],
"isTerminal":false,
"text":"",
"repr":""
}
],
"isTerminal":false,
"text":"",
"repr":""
}
],
"isTerminal":false,
"text":"",
"repr":""
}
],
"isTerminal":false,
"text":"",
"repr":""
}
],
"isTerminal":false,
"text":"",
"repr":""
}
],
"isTerminal":false,
"text":"",
"repr":""
}
],
"isTerminal":false,
"text":"",
"repr":""
}
],
"isTerminal":false,
"text":"",
"repr":""
}
],
"isTerminal":false,
"text":"",
"repr":""
}
],
"isTerminal":false,
"text":"",
"repr":""
},
{
"name":"ExpressionStatement",
"children":[
{
"name":"CallExpression",
"children":[
{
"name":"Identifier",
"children":[
],
"isTerminal":true,
"text":"describe",
"repr":"describe"
},
{
"name":"StringLiteral",
"children":[
],
"isTerminal":true,
"text":"\"#getPosition()\"",
"repr":"'#getPosition()'"
},
{
"name":"FunctionExpression",
"children":[
{
"name":"BlockStatement",
"children":[
{
"name":"ExpressionStatement",
"children":[
{
"name":"CallExpression",
"children":[
{
"name":"Identifier",
"children":[
],
"isTerminal":true,
"text":"it",
"repr":"it"
},
{
"name":"StringLiteral",
"children":[
],
"isTerminal":true,
"text":"\"should return the cursor\"",
"repr":"'should return the cursor'"
},
{
"name":"FunctionExpression",
"children":[
{
"name":"BlockStatement",
"children":[
{
"name":"ExpressionStatement",
"children":[
{
"name":"AssignmentExpression",
"children":[
{
"name":"MemberExpression",
"children":[
{
"name":"Identifier",
"children":[
],
"isTerminal":true,
"text":"packet",
"repr":"packet"
},
{
"name":"Identifier",
"children":[
],
"isTerminal":true,
"text":"cursor",
"repr":"cursor"
}
],
"isTerminal":false,
"text":"",
"repr":""
},
{
"name":"NumericLiteral",
"children":[
],
"isTerminal":true,
"text":"5",
"repr":"5"
}
],
"isTerminal":false,
"text":"",
"repr":""
}
],
"isTerminal":false,
"text":"",
"repr":""
},
{
"name":"ExpressionStatement",
"children":[
{
"name":"CallExpression",
"children":[
{
"name":"MemberExpression",
"children":[
{
"name":"MemberExpression",
"children":[
{
"name":"CallExpression",
"children":[
{
"name":"MemberExpression",
"children":[
{
"name":"Identifier",
"children":[
],
"isTerminal":true,
"text":"packet",
"repr":"packet"
},
{
"name":"Identifier",
"children":[
],
"isTerminal":true,
"text":"getPosition",
"repr":"getPosition"
}
],
"isTerminal":false,
"text":"",
"repr":""
}
],
"isTerminal":false,
"text":"",
"repr":""
},
{
"name":"Identifier",
"children":[
],
"isTerminal":true,
"text":"should",
"repr":"should"
}
],
"isTerminal":false,
"text":"",
"repr":""
},
{
"name":"Identifier",
"children":[
],
"isTerminal":true,
"text":"equal",
"repr":"equal"
}
],
"isTerminal":false,
"text":"",
"repr":""
},
{
"name":"NumericLiteral",
"children":[
],
"isTerminal":true,
"text":"5",
"repr":"5"
}
],
"isTerminal":false,
"text":"",
"repr":""
}
],
"isTerminal":false,
"text":"",
"repr":""
}
],
"isTerminal":false,
"text":"",
"repr":""
}
],
"isTerminal":false,
"text":"",
"repr":""
}
],
"isTerminal":false,
"text":"",
"repr":""
}
],
"isTerminal":false,
"text":"",
"repr":""
}
],
"isTerminal":false,
"text":"",
"repr":""
}
],
"isTerminal":false,
"text":"",
"repr":""
}
],
"isTerminal":false,
"text":"",
"repr":""
}
],
"isTerminal":false,
"text":"",
"repr":""
},
{
"name":"ExpressionStatement",
"children":[
{
"name":"CallExpression",
"children":[
{
"name":"Identifier",
"children":[
],
"isTerminal":true,
"text":"describe",
"repr":"describe"
},
{
"name":"StringLiteral",
"children":[
],
"isTerminal":true,
"text":"\"#writeString()\"",
"repr":"'#writeString()'"
},
{
"name":"FunctionExpression",
"children":[
{
"name":"BlockStatement",
"children":[
{
"name":"ExpressionStatement",
"children":[
{
"name":"CallExpression",
"children":[
{
"name":"Identifier",
"children":[
],
"isTerminal":true,
"text":"beforeEach",
"repr":"beforeEach"
},
{
"name":"FunctionExpression",
"children":[
{
"name":"BlockStatement",
"children":[
{
"name":"ExpressionStatement",
"children":[
{
"name":"CallExpression",
"children":[
{
"name":"MemberExpression",
"children":[
{
"name":"Identifier",
"children":[
],
"isTerminal":true,
"text":"packet",
"repr":"packet"
},
{
"name":"Identifier",
"children":[
],
"isTerminal":true,
"text":"writeString",
"repr":"writeString"
}
],
"isTerminal":false,
"text":"",
"repr":""
},
{
"name":"StringLiteral",
"children":[
],
"isTerminal":true,
"text":"\"a\"",
"repr":"'a'"
}
],
"isTerminal":false,
"text":"",
"repr":""
}
],
"isTerminal":false,
"text":"",
"repr":""
}
],
"isTerminal":false,
"text":"",
"repr":""
}
],
"isTerminal":false,
"text":"",
"repr":""
}
],
"isTerminal":false,
"text":"",
"repr":""
}
],
"isTerminal":false,
"text":"",
"repr":""
},
{
"name":"ExpressionStatement",
"children":[
{
"name":"CallExpression",
"children":[
{
"name":"Identifier",
"children":[
],
"isTerminal":true,
"text":"it",
"repr":"it"
},
{
"name":"StringLiteral",
"children":[
],
"isTerminal":true,
"text":"\"should write two bytes for string length at the cursor\"",
"repr":"'should write two bytes for string length at the cursor'"
},
{
"name":"FunctionExpression",
"children":[
{
"name":"BlockStatement",
"children":[
{
"name":"ExpressionStatement",
"children":[
{
"name":"CallExpression",
"children":[
{
"name":"MemberExpression",
"children":[
{
"name":"MemberExpression",
"children":[
{
"name":"CallExpression",
"children":[
{
"name":"MemberExpression",
"children":[
{
"name":"Identifier",
"children":[
],
"isTerminal":true,
"text":"packet",
"repr":"packet"
},
{
"name":"Identifier",
"children":[
],
"isTerminal":true,
"text":"getPosition",
"repr":"getPosition"
}
],
"isTerminal":false,
"text":"",
"repr":""
}
],
"isTerminal":false,
"text":"",
"repr":""
},
{
"name":"Identifier",
"children":[
],
"isTerminal":true,
"text":"should",
"repr":"should"
}
],
"isTerminal":false,
"text":"",
"repr":""
},
{
"name":"Identifier",
"children":[
],
"isTerminal":true,
"text":"equal",
"repr":"equal"
}
],
"isTerminal":false,
"text":"",
"repr":""
},
{
"name":"NumericLiteral",
"children":[
],
"isTerminal":true,
"text":"4",
"repr":"4"
}
],
"isTerminal":false,
"text":"",
"repr":""
}
],
"isTerminal":false,
"text":"",
"repr":""
},
{
"name":"ExpressionStatement",
"children":[
{
"name":"CallExpression",
"children":[
{
"name":"MemberExpression",
"children":[
{
"name":"MemberExpression",
"children":[
{
"name":"CallExpression",
"children":[
{
"name":"MemberExpression",
"children":[
{
"name":"MemberExpression",
"children":[
{
"name":"Identifier",
"children":[
],
"isTerminal":true,
"text":"packet",
"repr":"packet"
},
{
"name":"Identifier",
"children":[
],
"isTerminal":true,
"text":"buffer",
"repr":"buffer"
}
],
"isTerminal":false,
"text":"",
"repr":""
},
{
"name":"Identifier",
"children":[
],
"isTerminal":true,
"text":"readInt16BE",
"repr":"readInt16BE"
}
],
"isTerminal":false,
"text":"",
"repr":""
},
{
"name":"NumericLiteral",
"children":[
],
"isTerminal":true,
"text":"0",
"repr":"0"
}
],
"isTerminal":false,
"text":"",
"repr":""
},
{
"name":"Identifier",
"children":[
],
"isTerminal":true,
"text":"should",
"repr":"should"
}
],
"isTerminal":false,
"text":"",
"repr":""
},
{
"name":"Identifier",
"children":[
],
"isTerminal":true,
"text":"equal",
"repr":"equal"
}
],
"isTerminal":false,
"text":"",
"repr":""
},
{
"name":"NumericLiteral",
"children":[
],
"isTerminal":true,
"text":"1",
"repr":"1"
}
],
"isTerminal":false,
"text":"",
"repr":""
}
],
"isTerminal":false,
"text":"",
"repr":""
}
],
"isTerminal":false,
"text":"",
"repr":""
}
],
"isTerminal":false,
"text":"",
"repr":""
}
],
"isTerminal":false,
"text":"",
"repr":""
}
],
"isTerminal":false,
"text":"",
"repr":""
},
{
"name":"ExpressionStatement",
"children":[
{
"name":"CallExpression",
"children":[
{
"name":"Identifier",
"children":[
],
"isTerminal":true,
"text":"it",
"repr":"it"
},
{
"name":"StringLiteral",
"children":[
],
"isTerminal":true,
"text":"\"should write each letter as two bytes\"",
"repr":"'should write each letter as two bytes'"
},
{
"name":"FunctionExpression",
"children":[
{
"name":"BlockStatement",
"children":[
{
"name":"ExpressionStatement",
"children":[
{
"name":"CallExpression",
"children":[
{
"name":"MemberExpression",
"children":[
{
"name":"MemberExpression",
"children":[
{
"name":"CallExpression",
"children":[
{
"name":"MemberExpression",
"children":[
{
"name":"Identifier",
"children":[
],
"isTerminal":true,
"text":"packet",
"repr":"packet"
},
{
"name":"Identifier",
"children":[
],
"isTerminal":true,
"text":"getPosition",
"repr":"getPosition"
}
],
"isTerminal":false,
"text":"",
"repr":""
}
],
"isTerminal":false,
"text":"",
"repr":""
},
{
"name":"Identifier",
"children":[
],
"isTerminal":true,
"text":"should",
"repr":"should"
}
],
"isTerminal":false,
"text":"",
"repr":""
},
{
"name":"Identifier",
"children":[
],
"isTerminal":true,
"text":"equal",
"repr":"equal"
}
],
"isTerminal":false,
"text":"",
"repr":""
},
{
"name":"NumericLiteral",
"children":[
],
"isTerminal":true,
"text":"4",
"repr":"4"
}
],
"isTerminal":false,
"text":"",
"repr":""
}
],
"isTerminal":false,
"text":"",
"repr":""
},
{
"name":"ExpressionStatement",
"children":[
{
"name":"CallExpression",
"children":[
{
"name":"MemberExpression",
"children":[
{
"name":"MemberExpression",
"children":[
{
"name":"CallExpression",
"children":[
{
"name":"MemberExpression",
"children":[
{
"name":"MemberExpression",
"children":[
{
"name":"Identifier",
"children":[
],
"isTerminal":true,
"text":"packet",
"repr":"packet"
},
{
"name":"Identifier",
"children":[
],
"isTerminal":true,
"text":"buffer",
"repr":"buffer"
}
],
"isTerminal":false,
"text":"",
"repr":""
},
{
"name":"Identifier",
"children":[
],
"isTerminal":true,
"text":"readInt16BE",
"repr":"readInt16BE"
}
],
"isTerminal":false,
"text":"",
"repr":""
},
{
"name":"NumericLiteral",
"children":[
],
"isTerminal":true,
"text":"2",
"repr":"2"
}
],
"isTerminal":false,
"text":"",
"repr":""
},
{
"name":"Identifier",
"children":[
],
"isTerminal":true,
"text":"should",
"repr":"should"
}
],
"isTerminal":false,
"text":"",
"repr":""
},
{
"name":"Identifier",
"children":[
],
"isTerminal":true,
"text":"equal",
"repr":"equal"
}
],
"isTerminal":false,
"text":"",
"repr":""
},
{
"name":"NumericLiteral",
"children":[
],
"isTerminal":true,
"text":"97",
"repr":"97"
}
],
"isTerminal":false,
"text":"",
"repr":""
}
],
"isTerminal":false,
"text":"",
"repr":""
}
],
"isTerminal":false,
"text":"",
"repr":""
}
],
"isTerminal":false,
"text":"",
"repr":""
}
],
"isTerminal":false,
"text":"",
"repr":""
}
],
"isTerminal":false,
"text":"",
"repr":""
}
],
"isTerminal":false,
"text":"",
"repr":""
}
],
"isTerminal":false,
"text":"",
"repr":""
}
],
"isTerminal":false,
"text":"",
"repr":""
}
],
"isTerminal":false,
"text":"",
"repr":""
},
{
"name":"ExpressionStatement",
"children":[
{
"name":"CallExpression",
"children":[
{
"name":"Identifier",
"children":[
],
"isTerminal":true,
"text":"describe",
"repr":"describe"
},
{
"name":"StringLiteral",
"children":[
],
"isTerminal":true,
"text":"\"#writeArray()\"",
"repr":"'#writeArray()'"
},
{
"name":"FunctionExpression",
"children":[
{
"name":"BlockStatement",
"children":[
{
"name":"ExpressionStatement",
"children":[
{
"name":"CallExpression",
"children":[
{
"name":"Identifier",
"children":[
],
"isTerminal":true,
"text":"it",
"repr":"it"
},
{
"name":"StringLiteral",
"children":[
],
"isTerminal":true,
"text":"\"should write the contents of the provided buffer at the cursor\"",
"repr":"'should write the contents of the provided buffer at the cursor'"
},
{
"name":"FunctionExpression",
"children":[
{
"name":"BlockStatement",
"children":[
{
"name":"VariableDeclaration",
"children":[
{
"name":"VariableDeclarator",
"children":[
{
"name":"Identifier",
"children":[
],
"isTerminal":true,
"text":"buffer",
"repr":"buffer"
},
{
"name":"NewExpression",
"children":[
{
"name":"Identifier",
"children":[
],
"isTerminal":true,
"text":"Buffer",
"repr":"Buffer"
},
{
"name":"NumericLiteral",
"children":[
],
"isTerminal":true,
"text":"4",
"repr":"4"
}
],
"isTerminal":false,
"text":"",
"repr":""
}
],
"isTerminal":false,
"text":"",
"repr":""
}
],
"isTerminal":false,
"text":"",
"repr":""
},
{
"name":"ExpressionStatement",
"children":[
{
"name":"CallExpression",
"children":[
{
"name":"MemberExpression",
"children":[
{
"name":"Identifier",
"children":[
],
"isTerminal":true,
"text":"buffer",
"repr":"buffer"
},
{
"name":"Identifier",
"children":[
],
"isTerminal":true,
"text":"writeInt32BE",
"repr":"writeInt32BE"
}
],
"isTerminal":false,
"text":"",
"repr":""
},
{
"name":"NumericLiteral",
"children":[
],
"isTerminal":true,
"text":"1234567890",
"repr":"1234567890"
},
{
"name":"NumericLiteral",
"children":[
],
"isTerminal":true,
"text":"0",
"repr":"0"
}
],
"isTerminal":false,
"text":"",
"repr":""
}
],
"isTerminal":false,
"text":"",
"repr":""
},
{
"name":"ExpressionStatement",
"children":[
{
"name":"CallExpression",
"children":[
{
"name":"MemberExpression",
"children":[
{
"name":"Identifier",
"children":[
],
"isTerminal":true,
"text":"packet",
"repr":"packet"
},
{
"name":"Identifier",
"children":[
],
"isTerminal":true,
"text":"writeArray",
"repr":"writeArray"
}
],
"isTerminal":false,
"text":"",
"repr":""
},
{
"name":"Identifier",
"children":[
],
"isTerminal":true,
"text":"buffer",
"repr":"buffer"
}
],
"isTerminal":false,
"text":"",
"repr":""
}
],
"isTerminal":false,
"text":"",
"repr":""
},
{
"name":"ExpressionStatement",
"children":[
{
"name":"CallExpression",
"children":[
{
"name":"MemberExpression",
"children":[
{
"name":"MemberExpression",
"children":[
{
"name":"CallExpression",
"children":[
{
"name":"MemberExpression",
"children":[
{
"name":"Identifier",
"children":[
],
"isTerminal":true,
"text":"packet",
"repr":"packet"
},
{
"name":"Identifier",
"children":[
],
"isTerminal":true,
"text":"getPosition",
"repr":"getPosition"
}
],
"isTerminal":false,
"text":"",
"repr":""
}
],
"isTerminal":false,
"text":"",
"repr":""
},
{
"name":"Identifier",
"children":[
],
"isTerminal":true,
"text":"should",
"repr":"should"
}
],
"isTerminal":false,
"text":"",
"repr":""
},
{
"name":"Identifier",
"children":[
],
"isTerminal":true,
"text":"equal",
"repr":"equal"
}
],
"isTerminal":false,
"text":"",
"repr":""
},
{
"name":"NumericLiteral",
"children":[
],
"isTerminal":true,
"text":"4",
"repr":"4"
}
],
"isTerminal":false,
"text":"",
"repr":""
}
],
"isTerminal":false,
"text":"",
"repr":""
},
{
"name":"ExpressionStatement",
"children":[
{
"name":"CallExpression",
"children":[
{
"name":"MemberExpression",
"children":[
{
"name":"MemberExpression",
"children":[
{
"name":"CallExpression",
"children":[
{
"name":"MemberExpression",
"children":[
{
"name":"MemberExpression",
"children":[
{
"name":"Identifier",
"children":[
],
"isTerminal":true,
"text":"packet",
"repr":"packet"
},
{
"name":"Identifier",
"children":[
],
"isTerminal":true,
"text":"buffer",
"repr":"buffer"
}
],
"isTerminal":false,
"text":"",
"repr":""
},
{
"name":"Identifier",
"children":[
],
"isTerminal":true,
"text":"readInt32BE",
"repr":"readInt32BE"
}
],
"isTerminal":false,
"text":"",
"repr":""
},
{
"name":"NumericLiteral",
"children":[
],
"isTerminal":true,
"text":"0",
"repr":"0"
}
],
"isTerminal":false,
"text":"",
"repr":""
},
{
"name":"Identifier",
"children":[
],
"isTerminal":true,
"text":"should",
"repr":"should"
}
],
"isTerminal":false,
"text":"",
"repr":""
},
{
"name":"Identifier",
"children":[
],
"isTerminal":true,
"text":"equal",
"repr":"equal"
}
],
"isTerminal":false,
"text":"",
"repr":""
},
{
"name":"NumericLiteral",
"children":[
],
"isTerminal":true,
"text":"1234567890",
"repr":"1234567890"
}
],
"isTerminal":false,
"text":"",
"repr":""
}
],
"isTerminal":false,
"text":"",
"repr":""
}
],
"isTerminal":false,
"text":"",
"repr":""
}
],
"isTerminal":false,
"text":"",
"repr":""
}
],
"isTerminal":false,
"text":"",
"repr":""
}
],
"isTerminal":false,
"text":"",
"repr":""
},
{
"name":"ExpressionStatement",
"children":[
{
"name":"CallExpression",
"children":[
{
"name":"Identifier",
"children":[
],
"isTerminal":true,
"text":"it",
"repr":"it"
},
{
"name":"StringLiteral",
"children":[
],
"isTerminal":true,
"text":"\"should incrament the cursor based on the length of the given buffer\"",
"repr":"'should incrament the cursor based on the length of the given buffer'"
},
{
"name":"FunctionExpression",
"children":[
{
"name":"BlockStatement",
"children":[
{
"name":"VariableDeclaration",
"children":[
{
"name":"VariableDeclarator",
"children":[
{
"name":"Identifier",
"children":[
],
"isTerminal":true,
"text":"startingCursor",
"repr":"startingCursor"
},
{
"name":"MemberExpression",
"children":[
{
"name":"Identifier",
"children":[
],
"isTerminal":true,
"text":"packet",
"repr":"packet"
},
{
"name":"Identifier",
"children":[
],
"isTerminal":true,
"text":"cursor",
"repr":"cursor"
}
],
"isTerminal":false,
"text":"",
"repr":""
}
],
"isTerminal":false,
"text":"",
"repr":""
}
],
"isTerminal":false,
"text":"",
"repr":""
},
{
"name":"VariableDeclaration",
"children":[
{
"name":"VariableDeclarator",
"children":[
{
"name":"Identifier",
"children":[
],
"isTerminal":true,
"text":"buffer",
"repr":"buffer"
},
{
"name":"NewExpression",
"children":[
{
"name":"Identifier",
"children":[
],
"isTerminal":true,
"text":"Buffer",
"repr":"Buffer"
},
{
"name":"NumericLiteral",
"children":[
],
"isTerminal":true,
"text":"8",
"repr":"8"
}
],
"isTerminal":false,
"text":"",
"repr":""
}
],
"isTerminal":false,
"text":"",
"repr":""
}
],
"isTerminal":false,
"text":"",
"repr":""
},
{
"name":"ExpressionStatement",
"children":[
{
"name":"CallExpression",
"children":[
{
"name":"MemberExpression",
"children":[
{
"name":"Identifier",
"children":[
],
"isTerminal":true,
"text":"packet",
"repr":"packet"
},
{
"name":"Identifier",
"children":[
],
"isTerminal":true,
"text":"writeArray",
"repr":"writeArray"
}
],
"isTerminal":false,
"text":"",
"repr":""
},
{
"name":"Identifier",
"children":[
],
"isTerminal":true,
"text":"buffer",
"repr":"buffer"
}
],
"isTerminal":false,
"text":"",
"repr":""
}
],
"isTerminal":false,
"text":"",
"repr":""
},
{
"name":"ExpressionStatement",
"children":[
{
"name":"CallExpression",
"children":[
{
"name":"MemberExpression",
"children":[
{
"name":"MemberExpression",
"children":[
{
"name":"CallExpression",
"children":[
{
"name":"MemberExpression",
"children":[
{
"name":"Identifier",
"children":[
],
"isTerminal":true,
"text":"packet",
"repr":"packet"
},
{
"name":"Identifier",
"children":[
],
"isTerminal":true,
"text":"getPosition",
"repr":"getPosition"
}
],
"isTerminal":false,
"text":"",
"repr":""
}
],
"isTerminal":false,
"text":"",
"repr":""
},
{
"name":"Identifier",
"children":[
],
"isTerminal":true,
"text":"should",
"repr":"should"
}
],
"isTerminal":false,
"text":"",
"repr":""
},
{
"name":"Identifier",
"children":[
],
"isTerminal":true,
"text":"equal",
"repr":"equal"
}
],
"isTerminal":false,
"text":"",
"repr":""
},
{
"name":"BinaryExpression",
"children":[
{
"name":"Identifier",
"children":[
],
"isTerminal":true,
"text":"startingCursor",
"repr":"startingCursor"
},
{
"name":"MemberExpression",
"children":[
{
"name":"Identifier",
"children":[
],
"isTerminal":true,
"text":"buffer",
"repr":"buffer"
},
{
"name":"Identifier",
"children":[
],
"isTerminal":true,
"text":"length",
"repr":"length"
}
],
"isTerminal":false,
"text":"",
"repr":""
}
],
"isTerminal":false,
"text":"",
"repr":""
}
],
"isTerminal":false,
"text":"",
"repr":""
}
],
"isTerminal":false,
"text":"",
"repr":""
}
],
"isTerminal":false,
"text":"",
"repr":""
}
],
"isTerminal":false,
"text":"",
"repr":""
}
],
"isTerminal":false,
"text":"",
"repr":""
}
],
"isTerminal":false,
"text":"",
"repr":""
}
],
"isTerminal":false,
"text":"",
"repr":""
}
],
"isTerminal":false,
"text":"",
"repr":""
}
],
"isTerminal":false,
"text":"",
"repr":""
}
],
"isTerminal":false,
"text":"",
"repr":""
},
{
"name":"ExpressionStatement",
"children":[
{
"name":"CallExpression",
"children":[
{
"name":"Identifier",
"children":[
],
"isTerminal":true,
"text":"describe",
"repr":"describe"
},
{
"name":"StringLiteral",
"children":[
],
"isTerminal":true,
"text":"\"#writeBool()\"",
"repr":"'#writeBool()'"
},
{
"name":"FunctionExpression",
"children":[
{
"name":"BlockStatement",
"children":[
{
"name":"ExpressionStatement",
"children":[
{
"name":"CallExpression",
"children":[
{
"name":"Identifier",
"children":[
],
"isTerminal":true,
"text":"it",
"repr":"it"
},
{
"name":"StringLiteral",
"children":[
],
"isTerminal":true,
"text":"\"should write the contents of the provided buffer at the cursor\"",
"repr":"'should write the contents of the provided buffer at the cursor'"
},
{
"name":"FunctionExpression",
"children":[
{
"name":"BlockStatement",
"children":[
{
"name":"ExpressionStatement",
"children":[
{
"name":"CallExpression",
"children":[
{
"name":"MemberExpression",
"children":[
{
"name":"Identifier",
"children":[
],
"isTerminal":true,
"text":"packet",
"repr":"packet"
},
{
"name":"Identifier",
"children":[
],
"isTerminal":true,
"text":"writeBool",
"repr":"writeBool"
}
],
"isTerminal":false,
"text":"",
"repr":""
},
{
"name":"BooleanLiteral",
"children":[
],
"isTerminal":true,
"text":"true",
"repr":"true"
}
],
"isTerminal":false,
"text":"",
"repr":""
}
],
"isTerminal":false,
"text":"",
"repr":""
},
{
"name":"ExpressionStatement",
"children":[
{
"name":"CallExpression",
"children":[
{
"name":"MemberExpression",
"children":[
{
"name":"MemberExpression",
"children":[
{
"name":"CallExpression",
"children":[
{
"name":"MemberExpression",
"children":[
{
"name":"Identifier",
"children":[
],
"isTerminal":true,
"text":"packet",
"repr":"packet"
},
{
"name":"Identifier",
"children":[
],
"isTerminal":true,
"text":"getPosition",
"repr":"getPosition"
}
],
"isTerminal":false,
"text":"",
"repr":""
}
],
"isTerminal":false,
"text":"",
"repr":""
},
{
"name":"Identifier",
"children":[
],
"isTerminal":true,
"text":"should",
"repr":"should"
}
],
"isTerminal":false,
"text":"",
"repr":""
},
{
"name":"Identifier",
"children":[
],
"isTerminal":true,
"text":"equal",
"repr":"equal"
}
],
"isTerminal":false,
"text":"",
"repr":""
},
{
"name":"NumericLiteral",
"children":[
],
"isTerminal":true,
"text":"1",
"repr":"1"
}
],
"isTerminal":false,
"text":"",
"repr":""
}
],
"isTerminal":false,
"text":"",
"repr":""
},
{
"name":"ExpressionStatement",
"children":[
{
"name":"CallExpression",
"children":[
{
"name":"MemberExpression",
"children":[
{
"name":"MemberExpression",
"children":[
{
"name":"CallExpression",
"children":[
{
"name":"MemberExpression",
"children":[
{
"name":"MemberExpression",
"children":[
{
"name":"Identifier",
"children":[
],
"isTerminal":true,
"text":"packet",
"repr":"packet"
},
{
"name":"Identifier",
"children":[
],
"isTerminal":true,
"text":"buffer",
"repr":"buffer"
}
],
"isTerminal":false,
"text":"",
"repr":""
},
{
"name":"Identifier",
"children":[
],
"isTerminal":true,
"text":"readUInt8",
"repr":"readUInt8"
}
],
"isTerminal":false,
"text":"",
"repr":""
},
{
"name":"NumericLiteral",
"children":[
],
"isTerminal":true,
"text":"0",
"repr":"0"
}
],
"isTerminal":false,
"text":"",
"repr":""
},
{
"name":"Identifier",
"children":[
],
"isTerminal":true,
"text":"should",
"repr":"should"
}
],
"isTerminal":false,
"text":"",
"repr":""
},
{
"name":"Identifier",
"children":[
],
"isTerminal":true,
"text":"equal",
"repr":"equal"
}
],
"isTerminal":false,
"text":"",
"repr":""
},
{
"name":"NumericLiteral",
"children":[
],
"isTerminal":true,
"text":"1",
"repr":"1"
}
],
"isTerminal":false,
"text":"",
"repr":""
}
],
"isTerminal":false,
"text":"",
"repr":""
}
],
"isTerminal":false,
"text":"",
"repr":""
}
],
"isTerminal":false,
"text":"",
"repr":""
}
],
"isTerminal":false,
"text":"",
"repr":""
}
],
"isTerminal":false,
"text":"",
"repr":""
},
{
"name":"ExpressionStatement",
"children":[
{
"name":"CallExpression",
"children":[
{
"name":"Identifier",
"children":[
],
"isTerminal":true,
"text":"it",
"repr":"it"
},
{
"name":"StringLiteral",
"children":[
],
"isTerminal":true,
"text":"\"should incrament the cursor by 1\"",
"repr":"'should incrament the cursor by 1'"
},
{
"name":"FunctionExpression",
"children":[
{
"name":"BlockStatement",
"children":[
{
"name":"VariableDeclaration",
"children":[
{
"name":"VariableDeclarator",
"children":[
{
"name":"Identifier",
"children":[
],
"isTerminal":true,
"text":"startingCursor",
"repr":"startingCursor"
},
{
"name":"MemberExpression",
"children":[
{
"name":"Identifier",
"children":[
],
"isTerminal":true,
"text":"packet",
"repr":"packet"
},
{
"name":"Identifier",
"children":[
],
"isTerminal":true,
"text":"cursor",
"repr":"cursor"
}
],
"isTerminal":false,
"text":"",
"repr":""
}
],
"isTerminal":false,
"text":"",
"repr":""
}
],
"isTerminal":false,
"text":"",
"repr":""
},
{
"name":"ExpressionStatement",
"children":[
{
"name":"CallExpression",
"children":[
{
"name":"MemberExpression",
"children":[
{
"name":"Identifier",
"children":[
],
"isTerminal":true,
"text":"packet",
"repr":"packet"
},
{
"name":"Identifier",
"children":[
],
"isTerminal":true,
"text":"writeBool",
"repr":"writeBool"
}
],
"isTerminal":false,
"text":"",
"repr":""
},
{
"name":"BooleanLiteral",
"children":[
],
"isTerminal":true,
"text":"true",
"repr":"true"
}
],
"isTerminal":false,
"text":"",
"repr":""
}
],
"isTerminal":false,
"text":"",
"repr":""
},
{
"name":"ExpressionStatement",
"children":[
{
"name":"CallExpression",
"children":[
{
"name":"MemberExpression",
"children":[
{
"name":"MemberExpression",
"children":[
{
"name":"CallExpression",
"children":[
{
"name":"MemberExpression",
"children":[
{
"name":"Identifier",
"children":[
],
"isTerminal":true,
"text":"packet",
"repr":"packet"
},
{
"name":"Identifier",
"children":[
],
"isTerminal":true,
"text":"getPosition",
"repr":"getPosition"
}
],
"isTerminal":false,
"text":"",
"repr":""
}
],
"isTerminal":false,
"text":"",
"repr":""
},
{
"name":"Identifier",
"children":[
],
"isTerminal":true,
"text":"should",
"repr":"should"
}
],
"isTerminal":false,
"text":"",
"repr":""
},
{
"name":"Identifier",
"children":[
],
"isTerminal":true,
"text":"equal",
"repr":"equal"
}
],
"isTerminal":false,
"text":"",
"repr":""
},
{
"name":"BinaryExpression",
"children":[
{
"name":"Identifier",
"children":[
],
"isTerminal":true,
"text":"startingCursor",
"repr":"startingCursor"
},
{
"name":"NumericLiteral",
"children":[
],
"isTerminal":true,
"text":"1",
"repr":"1"
}
],
"isTerminal":false,
"text":"",
"repr":""
}
],
"isTerminal":false,
"text":"",
"repr":""
}
],
"isTerminal":false,
"text":"",
"repr":""
}
],
"isTerminal":false,
"text":"",
"repr":""
}
],
"isTerminal":false,
"text":"",
"repr":""
}
],
"isTerminal":false,
"text":"",
"repr":""
}
],
"isTerminal":false,
"text":"",
"repr":""
}
],
"isTerminal":false,
"text":"",
"repr":""
}
],
"isTerminal":false,
"text":"",
"repr":""
}
],
"isTerminal":false,
"text":"",
"repr":""
}
],
"isTerminal":false,
"text":"",
"repr":""
}
],
"isTerminal":false,
"text":"",
"repr":""
}
],
"isTerminal":false,
"text":"",
"repr":""
}
],
"isTerminal":false,
"text":"",
"repr":""
}
],
"isTerminal":false,
"text":"",
"repr":""
}
],
"isTerminal":false,
"text":"",
"repr":""
}