Skip to content

Instantly share code, notes, and snippets.

@tudang
Created June 27, 2016 13:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tudang/4ddb635d381332d3b3ecc655d0af7dbf to your computer and use it in GitHub Desktop.
Save tudang/4ddb635d381332d3b3ecc655d0af7dbf to your computer and use it in GitHub Desktop.
"Semantic error: Error when calling primitive pop (my_table -> untag -> pop) line 20: argument 1 has type field, but formal count has type integer value"
// Metadata to count number of labels
header_type ingress_metadata_t {
fields {
count : 32;
}
}
// Count number of labels in the stack
parser parse_label {
extract(label_stack[next]);
set_metadata(ingress_metadata.count, (ingress_metadata.count + 1));
return select(latest.bos) {
0 : parse_label;
1 : ingress;
}
}
// Remove all labels
action untag() {
pop(label_stack, ingress_metadata.count);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment