I was thinking about how to make some kind of unit tests for
semantic-analyze-current-context.
First problem is that I dont understand the terminology used.
given this javascript file:
function fun1(a, b){
return a;
}
function fun2(a,b){ //1
return b;
}
I get:
Context Type: #<semantic-analyze-context context>
Bounds: (1 . 9)
Prefix: "function"
Prefix Classes: 'function
'variable
--------
What does Prefix and Prefix Classes mean?
Secondly, my idea was just to make some lame test to iterate forward
in test files and do semantic-analyze-current-context at each word
boundary or something.
If I do that manualy for the js file above, I get:
Debugger entered--Lisp error: (error "Invalid start symbol field_declaratio=
n")
signal(error ("Invalid start symbol field_declaration"))
error("Invalid start symbol %s" field_declaration)
wisent-parse([[(... ... ...) (... ... ... ... ...) (... ... ... ... ... .=
.. ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... =
... ... ... ... ... ...) (...) (...) (...) (...) (...) (...) (...) (... ...=
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...) (... =
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...) (.=
.. ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...)=
(... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... .=
..) (... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ..=
. ...) (...) (... ... ... ... ... ... ... ... ... ... ... ... ... ... ... .=
.. ... ... ...) (...) (... ... ... ... ... ... ... ... ... ... ... ... ... =
... ... ... ... ... ...) (... ...) (... ...) (... ...) (... ...) (... ...) =
(...) (... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... =
... ... ...) (... ...) (... ... ... ... ... ... ... ... ... ... ... ... ...=
... ... ... ... ... ...) (... ... ... ... ... ... ... ... ... ...) (... ..=
. ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...) (...=
...) (... ...) (... ... ... ... ... ... ... ... ... ... ... ... ... ... ..=
. ... ... ... ...) (...) (...) (...) (...) (...) (...) (...) (...) (...) (.=
..) (...) (...) (...) (...) (...) (...) (...) ...] [(... ... ...) (...) (..=
. ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... .=
.. ... ... ... ... ... ... ... ... ... ... ... ... ... ...) nil nil nil nil=
nil nil nil (... ... ... ... ... ... ...) (... ... ... ... ... ... ...) (.=
.. ... ... ... ... ... ...) (... ... ... ... ... ... ...) (... ... ... ... =
... ... ...) nil (... ... ... ... ... ... ...) nil (... ... ... ... ... ...=
... ... ... ... ... ... ... ... ... ... ... ... ... ...) nil nil nil nil n=
il nil (... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...=
... ... ...) nil (... ... ... ... ... ... ...) (... ... ...) (... ... ... =
... ... ... ...) (... ...) nil (... ... ... ... ... ... ...) nil nil nil ni=
l nil nil nil nil nil nil nil nil nil nil nil nil nil ...] ((Program . $$Pr=
ogram) (FormalParameterList . $$FormalParameterList)) [IterationExpression:=
1 IterationExpression:2 IterationExpression:3 IterationExpression:4 Iterati=
onExpression:5 IterationExpression:6 BitwiseORExpression:1 MemberExpression=
:1 BitwiseXORExpression:1 ArgumentList:1 FunctionDeclaration:0 ConditionalE=
xpression:1 IterationExpression:0]] wisent-lex nil field_declaration)
wisent-parse-stream(((VARIABLE 15 . 16) (COMMA 16 . 17) (VARIABLE 18 . 19=
)) field_declaration)
semantic-parse-stream(((VARIABLE 15 . 16) (COMMA 16 . 17) (VARIABLE 18 . =
19)) field_declaration)
semantic-repeat-parse-whole-stream(((VARIABLE 15 . 16) (COMMA 16 . 17) (V=
ARIABLE 18 . 19)) field_declaration t)
semantic-parse-region-default(15 19 field_declaration 0 t)
semantic-parse-region(15 19 field_declaration 0 t)
semantic-get-local-variables-java-mode()
semantic-get-local-variables()
semantic-analyze-current-context-default(16)
semantic-analyze-current-context(16)
call-interactively(semantic-analyze-current-context)
execute-extended-command(nil)
call-interactively(execute-extended-command)
at the cursor position at the end of "fun1".
If this is indeed a bug, the above method at least teaches us
something.
--=20
Joakim Verona
http://www.verona.se
|