This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| key: | |
| field: data | |
| sub: | |
| data: value | |
| another: | |
| sous: data | |
| nested: | |
| sub: information | |
| foo: bar |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| static int token_type(enum yaml_token_type_e yaml_token) | |
| { | |
| switch(yaml_token) | |
| { | |
| case YAML_NO_TOKEN : return 0; | |
| case YAML_STREAM_START_TOKEN : return STREAM_START; | |
| case YAML_STREAM_END_TOKEN : return STREAM_END; | |
| case YAML_BLOCK_MAPPING_START_TOKEN : return BLOCK_MAPPING_START; | |
| case YAML_BLOCK_END_TOKEN : return BLOCK_END; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| LDLIBS = -lyaml | |
| all: main | |
| main: main.o parser.o | |
| parser.c: parser.y | |
| lemon $^ | |
| .PHONY: clean |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* Read tokens */ | |
| while(1) { | |
| if (!yaml_parser_scan(&parser, &token)) { | |
| printf("ERROR: Parsing failed.\n"); | |
| retval = EXIT_FAILURE; | |
| goto done; | |
| } | |
| if (token.type == YAML_BLOCK_END_TOKEN || | |
| token.type == YAML_FLOW_SEQUENCE_END_TOKEN || |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const char *token_type_str[] = { | |
| "YAML_NO_TOKEN", | |
| /** A STREAM-START token. */ | |
| "YAML_STREAM_START_TOKEN", | |
| /** A STREAM-END token. */ | |
| "YAML_STREAM_END_TOKEN", | |
| /** A VERSION-DIRECTIVE token. */ | |
| "YAML_VERSION_DIRECTIVE_TOKEN", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| receipt: Oz-Ware Purchase Invoice | |
| date: 2012-08-06 | |
| customer: | |
| first_name: Dorothy | |
| family_name: Gale | |
| items: | |
| - part_no: A4786 | |
| descrip: Water Bucket (Filled) | |
| price: 1.47 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <yaml.h> | |
| int main(int argc, const char *argv[]) | |
| { | |
| FILE *file; | |
| yaml_parser_t parser; | |
| yaml_token_t token; | |
| int retval = EXIT_SUCCESS; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <ruby.h> | |
| #include "url_parser.h" | |
| static VALUE host_type (enum host_type type) | |
| { | |
| VALUE htype; | |
| switch (type) | |
| { | |
| case REGNAME: | |
| htype = rb_to_symbol (rb_str_new2 ("REGNAME")); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'spec_helper' | |
| require 'url_parser' | |
| describe UrlParser::URL do | |
| context 'valid URL' do | |
| subject (:url){ UrlParser::URL.new('https://alice:secret@example.com:80/path/index.php?filter=employee#first_name') } | |
| it { is_expected.to be_valid } | |
| describe "#scheme" do | |
| it { expect(url.scheme).to eql 'https' } | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| if (is_method("INVITE")) { | |
| if(cache_fetch("redis","user:$fU",$avp(authpass))){ | |
| $avp(authuser) = $fU; | |
| if(!pv_proxy_authorize("")) { | |
| xlog("L_INFO","$ci|$rm| Challeng proxy auth for user $avp(authuser)"); | |
| # store tries for 30 sec | |
| # each new try would increase expire to another 30 sec | |
| cache_add("redis", "auth:$fU:tries",1,30); | |
| # check if limit of tries reached | |
| cache_counter_fetch("redis","auth:$fU:tries", $var(tries)); |
NewerOlder