Skip to content
This repository has been archived by the owner on Mar 8, 2020. It is now read-only.

Commit

Permalink
Merge pull request #30 from juanjux/comments
Browse files Browse the repository at this point in the history
Update comments and SDK
  • Loading branch information
juanjux authored Feb 6, 2019
2 parents bf49ec0 + 25cdff2 commit 834a709
Show file tree
Hide file tree
Showing 26 changed files with 256 additions and 329 deletions.
194 changes: 59 additions & 135 deletions Gopkg.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Gopkg.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

[[constraint]]
name = "gopkg.in/bblfsh/sdk.v2"
version = "2.12.x"
version = "2.13.x"

[prune]
go-tests = true
Expand Down
4 changes: 2 additions & 2 deletions driver/normalizer/annotation.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,13 @@ func annAssign(typ string, opRoles ...role.Role) Mapping {

var Annotations = []Mapping{
AnnotateType(php.Comment, MapObj(Obj{
"text": UncommentCLike("text"),
"text": Var("text"),
}, Obj{
uast.KeyToken: Var("text"),
}), role.Comment, role.Noop),

AnnotateType(php.Doc, MapObj(Obj{
"text": UncommentCLike("text"),
"text": Var("text"),
}, Obj{
uast.KeyToken: Var("text"),
}), role.Comment, role.Noop, role.Documentation),
Expand Down
2 changes: 2 additions & 0 deletions driver/normalizer/normalizer.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ var Normalize = Transformers([][]Transformer{
{Mappings(Normalizers...)},
}...)

var PreprocessCode = []CodeTransformer{}

// Preprocessors is a block of AST preprocessing rules rules.
var Preprocessors = []Mapping{
MapPart("root", ObjMap{ // name field as string value
Expand Down
11 changes: 6 additions & 5 deletions driver/normalizer/transforms.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ package normalizer
import "gopkg.in/bblfsh/sdk.v2/driver"

var Transforms = driver.Transforms{
Namespace: "php",
Preprocess: Preprocess,
Normalize: Normalize,
Annotations: Native,
Code: Code,
Namespace: "php",
Preprocess: Preprocess,
PreprocessCode: PreprocessCode,
Normalize: Normalize,
Annotations: Native,
Code: Code,
}
2 changes: 1 addition & 1 deletion fixtures/array_def.php.uast
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@
},
comments: [
{ '@type': "Comment",
'@token': " short array syntax\n",
'@token': "// short array syntax\n",
'@role': [Comment, Noop],
'@pos': { '@type': "uast:Positions",
start: { '@type': "uast:Position",
Expand Down
4 changes: 2 additions & 2 deletions fixtures/bench_accumulator_factory.php.uast
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@
},
comments: [
{ '@type': "Comment",
'@token': "prints 10\n",
'@token': "//prints 10\n",
'@role': [Comment, Noop],
'@pos': { '@type': "uast:Positions",
start: { '@type': "uast:Position",
Expand Down Expand Up @@ -555,7 +555,7 @@
attributes: {
comments: [
{ '@type': "Comment",
'@token': "prints 20\n",
'@token': "//prints 20\n",
'@role': [Comment, Noop],
'@pos': { '@type': "uast:Positions",
start: { '@type': "uast:Position",
Expand Down
58 changes: 29 additions & 29 deletions fixtures/bench_n_queens.php.uast
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
},
comments: [
{ '@type': "Comment",
'@token': "Get the size of the board\n",
'@token': "//Get the size of the board\n",
'@role': [Comment, Noop],
'@pos': { '@type': "uast:Positions",
start: { '@type': "uast:Position",
Expand Down Expand Up @@ -135,7 +135,7 @@
},
comments: [
{ '@type': "Comment",
'@token': "Get the size of the board\n",
'@token': "//Get the size of the board\n",
'@role': [Comment, Noop],
'@pos': { '@type': "uast:Positions",
start: { '@type': "uast:Position",
Expand Down Expand Up @@ -262,7 +262,7 @@
byRef: false,
comments: [
{ '@type': "Comment",
'@token': " Function to rotate a board 90 degrees\n",
'@token': "// Function to rotate a board 90 degrees\n",
'@role': [Comment, Noop],
'@pos': { '@type': "uast:Positions",
start: { '@type': "uast:Position",
Expand Down Expand Up @@ -1104,7 +1104,7 @@
byRef: false,
comments: [
{ '@type': "Comment",
'@token': " This function will find rotations of a solution\n",
'@token': "// This function will find rotations of a solution\n",
'@role': [Comment, Noop],
'@pos': { '@type': "uast:Positions",
start: { '@type': "uast:Position",
Expand Down Expand Up @@ -1366,7 +1366,7 @@
},
comments: [
{ '@type': "Comment",
'@token': " Rotated 90\n",
'@token': "// Rotated 90\n",
'@role': [Comment, Noop],
'@pos': { '@type': "uast:Positions",
start: { '@type': "uast:Position",
Expand Down Expand Up @@ -1740,7 +1740,7 @@
},
comments: [
{ '@type': "Comment",
'@token': " Rotated 180\n",
'@token': "// Rotated 180\n",
'@role': [Comment, Noop],
'@pos': { '@type': "uast:Positions",
start: { '@type': "uast:Position",
Expand Down Expand Up @@ -2114,7 +2114,7 @@
},
comments: [
{ '@type': "Comment",
'@token': " Rotated 270\n",
'@token': "// Rotated 270\n",
'@role': [Comment, Noop],
'@pos': { '@type': "uast:Positions",
start: { '@type': "uast:Position",
Expand Down Expand Up @@ -2343,7 +2343,7 @@
},
comments: [
{ '@type': "Comment",
'@token': " Reflected\n",
'@token': "// Reflected\n",
'@role': [Comment, Noop],
'@pos': { '@type': "uast:Positions",
start: { '@type': "uast:Position",
Expand Down Expand Up @@ -2441,7 +2441,7 @@
},
comments: [
{ '@type': "Comment",
'@token': " Reflected\n",
'@token': "// Reflected\n",
'@role': [Comment, Noop],
'@pos': { '@type': "uast:Positions",
start: { '@type': "uast:Position",
Expand Down Expand Up @@ -2837,7 +2837,7 @@
},
comments: [
{ '@type': "Comment",
'@token': " Reflected and Rotated 90\n",
'@token': "// Reflected and Rotated 90\n",
'@role': [Comment, Noop],
'@pos': { '@type': "uast:Positions",
start: { '@type': "uast:Position",
Expand Down Expand Up @@ -3211,7 +3211,7 @@
},
comments: [
{ '@type': "Comment",
'@token': " Reflected and Rotated 180\n",
'@token': "// Reflected and Rotated 180\n",
'@role': [Comment, Noop],
'@pos': { '@type': "uast:Positions",
start: { '@type': "uast:Position",
Expand Down Expand Up @@ -3585,7 +3585,7 @@
},
comments: [
{ '@type': "Comment",
'@token': " Reflected and Rotated 270\n",
'@token': "// Reflected and Rotated 270\n",
'@role': [Comment, Noop],
'@pos': { '@type': "uast:Positions",
start: { '@type': "uast:Position",
Expand Down Expand Up @@ -3854,7 +3854,7 @@
byRef: false,
comments: [
{ '@type': "Comment",
'@token': " This is a function which will render the board\n",
'@token': "// This is a function which will render the board\n",
'@role': [Comment, Noop],
'@pos': { '@type': "uast:Positions",
start: { '@type': "uast:Position",
Expand Down Expand Up @@ -5171,7 +5171,7 @@
byRef: false,
comments: [
{ '@type': "Comment",
'@token': "This function allows me to generate the next order of rows.\n",
'@token': "//This function allows me to generate the next order of rows.\n",
'@role': [Comment, Noop],
'@pos': { '@type': "uast:Positions",
start: { '@type': "uast:Position",
Expand Down Expand Up @@ -5379,7 +5379,7 @@
},
comments: [
{ '@type': "Comment",
'@token': " slide down the array looking for where we're smaller than the next guy \n",
'@token': "// slide down the array looking for where we're smaller than the next guy \n",
'@role': [Comment, Noop],
'@pos': { '@type': "uast:Positions",
start: { '@type': "uast:Position",
Expand Down Expand Up @@ -5704,7 +5704,7 @@
},
comments: [
{ '@type': "Comment",
'@token': " if this doesn't occur, we've finished our permutations \n",
'@token': "// if this doesn't occur, we've finished our permutations \n",
'@role': [Comment, Noop],
'@pos': { '@type': "uast:Positions",
start: { '@type': "uast:Position",
Expand All @@ -5715,7 +5715,7 @@
},
},
{ '@type': "Comment",
'@token': " the array is reversed: (1, 2, 3, 4) => (4, 3, 2, 1) \n",
'@token': "// the array is reversed: (1, 2, 3, 4) => (4, 3, 2, 1) \n",
'@role': [Comment, Noop],
'@pos': { '@type': "uast:Positions",
start: { '@type': "uast:Position",
Expand Down Expand Up @@ -5863,7 +5863,7 @@
},
comments: [
{ '@type': "Comment",
'@token': " slide down the array looking for a bigger number than what we found before \n",
'@token': "// slide down the array looking for a bigger number than what we found before \n",
'@role': [Comment, Noop],
'@pos': { '@type': "uast:Positions",
start: { '@type': "uast:Position",
Expand Down Expand Up @@ -6120,7 +6120,7 @@
},
comments: [
{ '@type': "Comment",
'@token': " swap them \n",
'@token': "// swap them \n",
'@role': [Comment, Noop],
'@pos': { '@type': "uast:Positions",
start: { '@type': "uast:Position",
Expand Down Expand Up @@ -6204,7 +6204,7 @@
},
comments: [
{ '@type': "Comment",
'@token': " swap them \n",
'@token': "// swap them \n",
'@role': [Comment, Noop],
'@pos': { '@type': "uast:Positions",
start: { '@type': "uast:Position",
Expand Down Expand Up @@ -6461,7 +6461,7 @@
},
comments: [
{ '@type': "Comment",
'@token': " now reverse the elements in between by swapping the ends \n",
'@token': "// now reverse the elements in between by swapping the ends \n",
'@role': [Comment, Noop],
'@pos': { '@type': "uast:Positions",
start: { '@type': "uast:Position",
Expand Down Expand Up @@ -7074,7 +7074,7 @@
byRef: false,
comments: [
{ '@type': "Comment",
'@token': "This function needs to check the current state to see if there are any \n",
'@token': "//This function needs to check the current state to see if there are any \n",
'@role': [Comment, Noop],
'@pos': { '@type': "uast:Positions",
start: { '@type': "uast:Position",
Expand Down Expand Up @@ -7221,7 +7221,7 @@
},
comments: [
{ '@type': "Comment",
'@token': "this is the row being checked\n",
'@token': "//this is the row being checked\n",
'@role': [Comment, Noop],
'@pos': { '@type': "uast:Positions",
start: { '@type': "uast:Position",
Expand Down Expand Up @@ -8416,7 +8416,7 @@
},
comments: [
{ '@type': "Comment",
'@token': "Within here is the code that needs to be run if process is clicked.\n",
'@token': "//Within here is the code that needs to be run if process is clicked.\n",
'@role': [Comment, Noop],
'@pos': { '@type': "uast:Positions",
start: { '@type': "uast:Position",
Expand All @@ -8427,7 +8427,7 @@
},
},
{ '@type': "Comment",
'@token': "First I need to create the different possible rows\n",
'@token': "//First I need to create the different possible rows\n",
'@role': [Comment, Noop],
'@pos': { '@type': "uast:Positions",
start: { '@type': "uast:Position",
Expand Down Expand Up @@ -8738,7 +8738,7 @@
},
comments: [
{ '@type': "Comment",
'@token': "Now I need to create all the possible orders of rows, will be equal to [boardY]!\n",
'@token': "//Now I need to create all the possible orders of rows, will be equal to [boardY]!\n",
'@role': [Comment, Noop],
'@pos': { '@type': "uast:Positions",
start: { '@type': "uast:Position",
Expand Down Expand Up @@ -8784,7 +8784,7 @@
},
comments: [
{ '@type': "Comment",
'@token': "Now I need to create all the possible orders of rows, will be equal to [boardY]!\n",
'@token': "//Now I need to create all the possible orders of rows, will be equal to [boardY]!\n",
'@role': [Comment, Noop],
'@pos': { '@type': "uast:Positions",
start: { '@type': "uast:Position",
Expand Down Expand Up @@ -10022,7 +10022,7 @@
attributes: {
comments: [
{ '@type': "Comment",
'@token': "print_r($solutions);\n",
'@token': "//print_r($solutions);\n",
'@role': [Comment, Noop],
'@pos': { '@type': "uast:Positions",
start: { '@type': "uast:Position",
Expand Down Expand Up @@ -10053,7 +10053,7 @@
},
comments: [
{ '@type': "Comment",
'@token': "This code collects the starting parameters\n",
'@token': "//This code collects the starting parameters\n",
'@role': [Comment, Noop],
'@pos': { '@type': "uast:Positions",
start: { '@type': "uast:Position",
Expand Down
8 changes: 4 additions & 4 deletions fixtures/bench_power_set.php.uast
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
},
comments: [
{ '@type': "Comment",
'@token': " based on true/false values in $binary array, include/exclude\n",
'@token': "// based on true/false values in $binary array, include/exclude\n",
'@role': [Comment, Noop],
'@pos': { '@type': "uast:Positions",
start: { '@type': "uast:Position",
Expand All @@ -108,7 +108,7 @@
},
},
{ '@type': "Comment",
'@token': " values from $arr\n",
'@token': "// values from $arr\n",
'@role': [Comment, Noop],
'@pos': { '@type': "uast:Positions",
start: { '@type': "uast:Position",
Expand Down Expand Up @@ -154,7 +154,7 @@
},
comments: [
{ '@type': "Comment",
'@token': " based on true/false values in $binary array, include/exclude\n",
'@token': "// based on true/false values in $binary array, include/exclude\n",
'@role': [Comment, Noop],
'@pos': { '@type': "uast:Positions",
start: { '@type': "uast:Position",
Expand All @@ -165,7 +165,7 @@
},
},
{ '@type': "Comment",
'@token': " values from $arr\n",
'@token': "// values from $arr\n",
'@role': [Comment, Noop],
'@pos': { '@type': "uast:Positions",
start: { '@type': "uast:Position",
Expand Down
Loading

0 comments on commit 834a709

Please sign in to comment.