Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extensible grammar and runtime #420

Merged
merged 36 commits into from Apr 5, 2017
Merged

Extensible grammar and runtime #420

merged 36 commits into from Apr 5, 2017

Conversation

jfallows
Copy link
Member

@jfallows jfallows commented Mar 31, 2017

Note: this requires a backwards incompatible change in the K3PO grammar.
Note: upgrade script provided in tools/upgrade.sed

Added an extensible TypeSystem used by the parser to support custom language elements not present in the core, such as http:method, http:version http:header, and http:status.

accept "http://localhost:8080/path?query"

accepted
connected

read http:method "GET"
read http:version "HTTP/1.1"
read http:header "Host" "localhost:8080"
read http:header "Upgrade" /(?i:websocket)/
read http:header "Connection" /(?i:Upgrade)/
read http:header "Sec-WebSocket-Key" /(?<key>[a-zA-Z0-9+\/=]{24})/
read http:header "Sec-WebSocket-Version" "13"

write http:status "101" "Switching Protocols"
write http:version "HTTP/1.1"
write http:header "Upgrade" "websocket"
write http:header "Connection" "Upgrade"
write http:header "Sec-WebSocket-Accept" ${ws:handshakeHash(key)}
write flush

# connection established

Added an extensible BehaviorSystem used by driver to support runtime enforcement of custom language elements.

New transport schemes can now be implemented outside the K3PO project and be discovered via ServiceLoader by placing the artifact on the <dependency> classpath of the k3po-maven-plugin.

John Fallows added 28 commits March 14, 2017 23:22
Conflicts:
	specification/k3po.control/src/main/scripts/org/kaazing/specification/control/accept.already.prepared.or.started.rpt
	specification/k3po.control/src/main/scripts/org/kaazing/specification/control/accept.finished.with.barriers.rpt
	specification/k3po.control/src/main/scripts/org/kaazing/specification/control/connect.already.prepared.or.started.rpt
	specification/k3po.control/src/main/scripts/org/kaazing/specification/control/connect.finished.with.barriers.rpt
@jfallows jfallows requested a review from dpwspoon March 31, 2017 04:20
@@ -15,7 +15,7 @@
#

#
# read and write track file position independently
#read andwrite track file position independently
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

format clean up shouldn't change this

@@ -26,7 +26,7 @@ write http:header "Trailer" "Trailing-Header"
write "Chunk A"
write "Chunk B"
# Not supported in netty 3.9
# write option chunkExtension "some-extension-value"
#write option chunkExtension "some-extension-value"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

format clean up should not change this comment

@dpwspoon
Copy link
Member

dpwspoon commented Mar 31, 2017

It whould be nice to now write:

write http:version "HTTP/1.1"
write http:header "Upgrade" "websocket"
write http:header "Connection" "Upgrade"

as

write http:version "HTTP/1.1"
      http:header "Upgrade" "websocket"
      http:header "Connection" "Upgrade"

Which I don't think is possible as Robot.g is now:


commandNode
      : writeNode		 
      : writeConfigNode

...

writeConfigNode
     : WriteKeyword QualifiedName writeValue*

@dpwspoon
Copy link
Member

dpwspoon commented Mar 31, 2017

StructuredTypeInfo needs to

@Override 
public String toString()

as it is called in several Ast*Nodes describe()

@dpwspoon
Copy link
Member

Should BehaviorSystem and others (WriteOptionFactory, ReadOptionFactory) be in public API (i.e. not internal packaging). Maybe file a follow-up ticket?

@@ -15,7 +15,7 @@
#

#
# read and write track file position independently
#read andwrite track file position independently
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sed script should not alter any comment lines

@cmebarrow
Copy link
Member

@jfallows Since connect and accept uri is now quoted will it allow syntax like

connect "nukleus://streams/{$target}"

that we agreed we'll need for http spec tests?

John Fallows added 2 commits March 31, 2017 13:16
@jfallows jfallows self-assigned this Mar 31, 2017
@jfallows
Copy link
Member Author

The .toString() is now added, the upgrade.sed script now skips "tidying" of comments and has been re-applied to the specification scripts.

The grammar updates for consecutive write http:header (or similar) and "http://localhost:8080/${path}" syntax are both enhancements beyond the scope of this PR which aims to make K3PO extensible.

@jfallows
Copy link
Member Author

Investigating build breakage on Travis.

@jfallows
Copy link
Member Author

Travis build working again.

@jfallows
Copy link
Member Author

jfallows commented Apr 3, 2017

Note: we might need some further (minor) changes on stream validation to support custom extensions after write close.

@jfallows
Copy link
Member Author

jfallows commented Apr 4, 2017

Note: no need to hold for any changes on stream validation.

@dpwspoon dpwspoon merged commit bc93ae9 into k3po:develop Apr 5, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants