ragel scanner that comes close to operating

%%{
  machine scanner;

  Number = digit+;

  Constant = Number;

  Drop = '^' | 'v';
  Series = Number 'd' Number Drop?;

  Arithmetic = '+' | '-' | '*' | '/';

  UnaryExpression = Series | Constant;
  BinaryExpression = UnaryExpression (space* Arithmetic space* UnaryExpression)+;
  Expression = UnaryExpression | BinaryExpression;

  main := Expression;
}%%

error: pathspec 'lib/crapshoot/scanner/scan.rl' did not match any file(s) known to git


2level nesting

2level nesting

%%{
  machine params_parser;
  action H { @head = p }
  action T { @tail = p }
  action inject_key { @hash[key] = {} }

  EOL = ('\n' | '\r\n');
  DELIMITER = ([, ])+                            >H@T @{ log_event(:delimiter) };
  LEVEL = [(]                                    >H@T @{ log_event(:level) };
  END_LEVEL = [)]                                >H@T @{ log_event(:end_level) };
  INPUT = (any - LEVEL - END_LEVEL - DELIMITER)+ >H@T @{ log_event(:input); memo_key; };

  main := (
    INPUT?
    (DELIMITER @{ fnext main; } | LEVEL @{ @hash[key] = {}; @parent = @hash; @hash = @hash[key]; fcall nested; })
  )*;

  nested := (
    INPUT
    (DELIMITER @{ @hash[key] = {}; fnext nested; } | END_LEVEL @{ @hash[key] = {}; @hash = @parent; fret; })
  );
}%%

module ParamsTree
  class Parser
    attr_accessor :data

    def initialize
      @events = []
      @hash = {}
      @parent = {}
      @key = nil
      %% write data;
    end

    def process(input)
      @data = input.unpack('c*')
      stack = []

      %% write init;
      %% write exec;

      puts @events.inspect
      puts key
      puts @hash.inspect
      puts @parent.inspect
    end

    def char
      @data[@head..@tail]
    end

    def strokes
      char.pack('c*')
    end

    def log_event(token)
      @events << { token => strokes }
    end

    def memo_key
      @key = char
    end

    def key
      @key.pack('c*')
    end
  end
end

ParamsTree::Parser.new.process "default(all,usadasdid),isdsdd(wow,er),sed(rew,tre,yrt)"

error: pathspec 'hello_world.rl' did not match any file(s) known to git


Comment consistency

Comment consistency

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/gim/libgim.git/'


[Fix] Treat empty address as valid

[Fix] Treat empty address as valid

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/AlexeySa/rspamd.git/'


Removed magic constant, increased file buffer size when sending file.

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/meqif/lolbot.git/'


Fixed tabs vs. spaces.

Fixed tabs vs. spaces.


parser: drop everything in the queue in case of error while parsing

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/meqif/redshell.git/'


parser: merged pattern.

parser: merged pattern.


Set number iostream precision to maximum


Added missing scanner_mb.rl file

Added missing scanner_mb.rl file

git-svn-id: 26a6d2a58b162bc133329b2f36847a121ee54040@972 06fd6eb0-0002-0410-a719-e5602cce40bc

/* scanner.rl -*-C-*- */
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <wchar.h>

#define RET do {                        \
    size_t __len = te - ts - skip - trunc; \
    if (__len > out_size)               \
        __len = out_size;               \
    *len     = __len;                   \
    *start   = ts;                      \
    *end     = te;                      \
     memcpy(out, ts + skip, __len);     \
     out[__len] = 0;                    \
     return;                            \
} while(0)

#define STRIP(c) do {                         \
    char *__p = ts;                           \
    char *__o = out;                          \
    char *__max = __p + out_size;             \
    for (; __p <= te && __p < __max; ++__p) { \
        if (*__p != c)                        \
            *__o++ = *__p;                    \
    }                                         \
    *__o = 0;                                 \
                                              \
    *start = ts;                              \
    *end   = te;                              \
    *len   = __o - out;                       \
    return;                                   \
} while(0)

static unsigned long towide( char *p )
{
    wchar_t w;
    size_t n = mbrtowc(&w, p, 10 /* XXX */, 0 /* XXX */);
    p += n - 1; /* XXX */
    return (unsigned long)w;
}

%%{
    machine StdTokMb;
    alphtype unsigned long;
    getkey towide(p);

    delim = space;
    token = alpha alnum*;
    punc  = [.,\/_\-];
    proto = 'http'[s]? | 'ftp' | 'file';
    urlc  = alnum | punc | [\@\:];

    main := |*

        #// Token, or token with possessive
        token           { RET; };
        token [\']      { trunc = 1; RET; };
        token [\'][sS]? { trunc = 2; RET; };

        #// Token with hyphens
        alnum+ ('-' alnum+)* { RET; };

        #// Company name
        token [\&\@] token* { RET; };

        #// URL
        proto [:][/]+ %{ skip = p - ts; } urlc+ [/] { trunc = 1; RET; };
        proto [:][/]+ %{ skip = p - ts; } urlc+     { RET; };
        alnum+[:][/]+ urlc+ [/] { trunc = 1; RET; };
        alnum+[:][/]+ urlc+     { RET; };

        #// Email
        alnum+ '@' alnum+ '.' alpha+ { RET; };

        #// Acronym
        (alpha '.')+ alpha { STRIP('.'); };

        #// Int+float
        [\-\+]?digit+            { RET; };
        [\-\+]?digit+ '.' digit+ { RET; };

        #// Ignore whitespace and other crap
        0 { return; };
        (any - alnum);

        *|;
}%%

%% write data nofinal;

void frt_std_scan_mb(const char *in,
                 char *out, size_t out_size,
                 char **start, char **end,
                 int *len)
{
    int cs, act;
    char *ts, *te = 0;

    %% write init;

    char *p = (char *)in;
    char *pe = 0;
    char *eof = pe;
    *len = 0;
    int skip = 0;
    int trunc = 0;

    %% write exec;

    if ( cs == StdTokMb_error )
    {
        fprintf(stderr, "PARSE ERROR\n" );
        return;
    }

    if ( ts )
    {
        fprintf(stderr, "STUFF LEFT: '%s'\n", ts);
    }
}

error: pathspec 'c/src/scanner_mb.rl' did not match any file(s) known to git


[Minor] Relax content type params values parser

Issue: #1682


uri: turn off parser tracing

uri: turn off parser tracing


parser: joined all parsing into the same FSM.


Add initial ragel grammar based on Stomp 1.2 ABNF

See http://stomp.github.io/stomp-specification-1.2.html#Augmented_BNF

module Stompede
  module Stomp
    %%{
      machine Message;

      NULL = "\0";
      LF = "\n";
      CR = "\r";
      EOL = CR? LF;
      OCTET = any;

      client_command = "SEND" | "SUBSCRIBE" | "UNSUBSCRIBE" | "BEGIN" | "COMMIT" | "ABORT" | "ACK" | "NACK" | "DISCONNECT" | "CONNECT" | "STOMP";
      server_command = "CONNECTED" | "MESSAGE" | "RECEIPT" | "ERROR";
      command = client_command | server_command;

      header_component = (OCTET - CR - LF - ":")+;
      header_name = header_component+;
      header_value = header_component*;
      header = header_name+ ":" header_value;

      frame = command EOL (header EOL)* EOL OCTET* NULL;

      main := frame;
    }%%

    def self.parse(message)
      %% write data;
      %% write init;
      %% write exec;
    end
  end
end

error: pathspec 'lib/stompede/stomp/parser.rl' did not match any file(s) known to git


Explicitly clear accumulator before parsing

This silences some (mistaken) reports from clang-analyzer


sign_cast to avoid char-to-uint warning

sign_cast to avoid char-to-uint warning


Add serialisers for float and int

Add serialisers for float and int


json: allow arrays as the root node

json: allow arrays as the root node


Clean up of table parsing, stop ragel from warning about plus operator for zero length word

module Gherkin
  class Table
    %%{
      machine table;

      action start_row {
        current_row = []
      }

      action end_row {
        @rows << current_row
      }

      action term_cell {
        current_row << data[@_s..(p-1)].pack('c*')
      }

      action start_cell {
        @_s = p
      }

      action nil_cell {
        current_row << nil
      }

      EOL = '\r'? '\n';
      BAR = space* '|';
      word = alnum+;

      non_empty_cell = space* word >start_cell %term_cell BAR;
      empty_cell = BAR %nil_cell;
      cell = (non_empty_cell | empty_cell);

      start_of_row = BAR @start_row;
      end_of_row = space* (zlen %/end_row)? :>> EOL %end_row;

      table_row = start_of_row cell+ :>> end_of_row;
      table = table_row+;

      main := table;
    }%%

    def initialize
      %% write data;
    end

    def scan(data, listener)
      @rows = []
      data = data.unpack("c*") if data.is_a?(String)
      eof = data.size
      %% write init;
      %% write exec;
      listener.table(@rows)
    end
  end
end

module Gherkin
  class Table
    %%{
      machine table;

      action start_row {
        current_row = []
      }

      action end_row {
        @rows << current_row
      }

      action term_cell {
        current_row << data[@_s..(p-1)].pack('c*')
      }

      action start_cell {
        @_s = p
      }

      action nil_cell {
        current_row << nil
      }

      EOL = '\r'? '\n';
      BAR = '|';

      non_empty_cell = ( alnum @start_cell ) alnum* %term_cell;
      empty_cell = space* %nil_cell;
      cell_contents = (space* non_empty_cell space* BAR)? (space* empty_cell? BAR)?;
      table_row = space* BAR @start_row (cell_contents)+ space* (zlen %/end_row)? :>> EOL @end_row;
      table = table_row+;

      main := table;
    }%%

    def initialize
      %% write data;
    end

    def scan(data, listener)
      @rows = []
      data = data.unpack("c*") if data.is_a?(String)
      eof = data.size
      %% write init;
      %% write exec;
      listener.table(@rows)
    end
  end
end


parser: fixed mixing of background and sequential commands


[Feature] Work with broken rfc2047 tokens


[core] fix exec command in admin console

/*
 * Copyright (C) 2010 Mail.RU
 * Copyright (C) 2010 Yuriy Vostrikov
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 */

#include <stdio.h>
#include <string.h>
#include <stdbool.h>
#include <unistd.h>
#include <stdlib.h>

#include <fiber.h>
#include <palloc.h>
#include <salloc.h>
#include <say.h>
#include <stat.h>
#include <tarantool.h>
#include <util.h>

static const char help[] =
	"available commands:\r\n"
	"help\r\n"
	"quit\r\n"
	"show info\r\n"
	"show fiber\r\n"
	"show configuration\r\n"
	"show slab\r\n"
	"show palloc\r\n"
	"show stat\r\n"
	"save coredump\r\n"
	"save snapshot\r\n"
	"exec module command\r\n"
	;

static const char unknown_command[] = "unknown command. try typing help.\r\n";

%%{
	machine admin;
	write data;
}%%

static void
ok(struct tbuf *out)
{
	tbuf_printf(out, "ok\r\n");
}

static void
end(struct tbuf *out)
{
	tbuf_printf(out, "---\r\n");
}

static int
admin_dispatch(void)
{
	struct tbuf *out = tbuf_alloc(fiber->pool);
	int cs;
	char *p, *pe;
	char *strstart, *strend;

	while ((pe = memchr(fiber->rbuf->data, '\n', fiber->rbuf->len)) == NULL) {
		if (fiber_bread(fiber->rbuf, 1) <= 0)
			return 0;
	}

	pe++;
	p = fiber->rbuf->data;

	%%{
		action show_configuration {
			tarantool_cfg_iterator_t *i;
			char *key, *value;

			tbuf_printf(out, "configuration:\n");
			i = tarantool_cfg_iterator_init();
			while ((key = tarantool_cfg_iterator_next(i, &cfg, &value)) != NULL) {
				if (value) {
					tbuf_printf(out, "  %s: \"%s\"\n", key, value);
					free(value);
				} else {
					tbuf_printf(out, "  %s: (null)\n", key);
				}
			}
			end(out);
		}

		eol = "\n" | "\r\n";
		show = "sh"("o"("w")?)?;
		info = "in"("f"("o")?)?;
		check = "ch"("e"("c"("k")?)?)?;
		configuration = "co"("n"("f"("i"("g"("u"("r"("a"("t"("i"("o"("n")?)?)?)?)?)?)?)?)?)?)?;
		fiber = "fi"("b"("e"("r")?)?)?;
		slab = "sl"("a"("b")?)?;
		mod = "mo"("d")?;
		palloc = "pa"("l"("l"("o"("c")?)?)?)?;
		stat = "st"("a"("t")?)?;
		help = "h"("e"("l"("p")?)?)?;
		quit = "q"("u"("i"("t")?)?)?;
		save = "sa"("v"("e")?)?;
		coredump = "co"("r"("e"("d"("u"("m"("p")?)?)?)?)?)?;
		snapshot = "sn"("a"("p"("s"("h"("o"("t")?)?)?)?)?)?;
		exec = "e"("x"("e"("c")?)?)?;
		string = any+ >{strstart = fpc;}  %{strend = fpc;};

		commands = (help			%{tbuf_append(out, help, sizeof(help));}|
			    quit			%{return 0;}				|
			    show " " info		%{mod_info(out); end(out);}		|
			    show " " fiber		%{fiber_info(out);end(out);}		|
			    show " " configuration 	%show_configuration			|
			    show " " slab		%{slab_stat(out);end(out);}		|
			    show " " palloc		%{palloc_stat(out);end(out);}		|
			    show " " stat		%{stat_print(out);end(out);}		|
			    save " " coredump		%{coredump(60); ok(out);}		|
			    save " " snapshot		%{snapshot(NULL, 0); ok(out);}		|
			    exec " " string		%{ mod_exec(strstart, strend - strstart, out); end(out); }		|
			    check " " slab		%{slab_validate(); ok(out);});

	        main := commands eol;
		write init;
		write exec;
	}%%

	fiber->rbuf->len -= (void *)pe - (void *)fiber->rbuf->data;
	fiber->rbuf->data = pe;

	if (p != pe)
		tbuf_append(out, unknown_command, sizeof(unknown_command));

	return fiber_write(out->data, out->len);
}

static void
admin_handler(void *_data __unused__)
{
	for (;;) {
		if (admin_dispatch() <= 0)
			return;
		fiber_gc();
	}
}

int
admin_init(void)
{
	if (fiber_server(tcp_server, cfg.admin_port, admin_handler, NULL, NULL) == NULL) {
		say_syserror("can't bind to %d", cfg.admin_port);
		return -1;
	}
	return 0;
}

/*
 * Local Variables:
 * mode: c
 * End:
 */

/*
 * Copyright (C) 2010 Mail.RU
 * Copyright (C) 2010 Yuriy Vostrikov
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 */

#include <stdio.h>
#include <string.h>
#include <stdbool.h>
#include <unistd.h>
#include <stdlib.h>

#include <fiber.h>
#include <palloc.h>
#include <salloc.h>
#include <say.h>
#include <stat.h>
#include <tarantool.h>
#include <util.h>

static const char help[] =
	"available commands:\r\n"
	"help\r\n"
	"quit\r\n"
	"show info\r\n"
	"show fiber\r\n"
	"show configuration\r\n"
	"show slab\r\n"
	"show palloc\r\n"
	"show stat\r\n"
	"save coredump\r\n"
	"save snapshot\r\n"
	"exec module command\r\n"
	;

static const char unknown_command[] = "unknown command. try typing help.\r\n";

%%{
	machine admin;
	write data;
}%%

static void
ok(struct tbuf *out)
{
	tbuf_printf(out, "ok\r\n");
}

static void
end(struct tbuf *out)
{
	tbuf_printf(out, "---\r\n");
}

static int
admin_dispatch(void)
{
	struct tbuf *out = tbuf_alloc(fiber->pool);
	int cs;
	char *p, *pe;
	char *strstart, *strend;

	while ((pe = memchr(fiber->rbuf->data, '\n', fiber->rbuf->len)) == NULL) {
		if (fiber_bread(fiber->rbuf, 1) <= 0)
			return 0;
	}

	pe++;
	p = fiber->rbuf->data;

	%%{
		action show_configuration {
			tarantool_cfg_iterator_t *i;
			char *key, *value;

			tbuf_printf(out, "configuration:\n");
			i = tarantool_cfg_iterator_init();
			while ((key = tarantool_cfg_iterator_next(i, &cfg, &value)) != NULL) {
				if (value) {
					tbuf_printf(out, "  %s: \"%s\"\n", key, value);
					free(value);
				} else {
					tbuf_printf(out, "  %s: (null)\n", key);
				}
			}
			end(out);
		}

		eol = "\n" | "\r\n";
		show = "sh"("o"("w")?)?;
		info = "in"("f"("o")?)?;
		check = "ch"("e"("c"("k")?)?)?;
		configuration = "co"("n"("f"("i"("g"("u"("r"("a"("t"("i"("o"("n")?)?)?)?)?)?)?)?)?)?)?;
		fiber = "fi"("b"("e"("r")?)?)?;
		slab = "sl"("a"("b")?)?;
		mod = "mo"("d")?;
		palloc = "pa"("l"("l"("o"("c")?)?)?)?;
		stat = "st"("a"("t")?)?;
		help = "h"("e"("l"("p")?)?)?;
		quit = "q"("u"("i"("t")?)?)?;
		save = "sa"("v"("e")?)?;
		coredump = "co"("r"("e"("d"("u"("m"("p")?)?)?)?)?)?;
		snapshot = "sn"("a"("p"("s"("h"("o"("t")?)?)?)?)?)?;
		exec = "e"("x"("e"("c")?)?)?;
		string = any+ >{strstart = p;}  %{strend = p;};

		commands = (help			%{tbuf_append(out, help, sizeof(help));}|
			    quit			%{return 0;}				|
			    show " " info		%{mod_info(out); end(out);}		|
			    show " " fiber		%{fiber_info(out);end(out);}		|
			    show " " configuration 	%show_configuration			|
			    show " " slab		%{slab_stat(out);end(out);}		|
			    show " " palloc		%{palloc_stat(out);end(out);}		|
			    show " " stat		%{stat_print(out);end(out);}		|
			    save " " coredump		%{coredump(60); ok(out);}		|
			    save " " snapshot		%{snapshot(NULL, 0); ok(out);}		|
			    exec " " string		%{ mod_exec(strstart, strstart - strend, out); end(out); }		|
			    check " " slab		%{slab_validate(); ok(out);});

	        main := commands eol;
		write init;
		write exec;
	}%%

	fiber->rbuf->len -= (void *)pe - (void *)fiber->rbuf->data;
	fiber->rbuf->data = pe;

	if (p != pe)
		tbuf_append(out, unknown_command, sizeof(unknown_command));

	return fiber_write(out->data, out->len);
}

static void
admin_handler(void *_data __unused__)
{
	for (;;) {
		if (admin_dispatch() <= 0)
			return;
		fiber_gc();
	}
}

int
admin_init(void)
{
	if (fiber_server(tcp_server, cfg.admin_port, admin_handler, NULL, NULL) == NULL) {
		say_syserror("can't bind to %d", cfg.admin_port);
		return -1;
	}
	return 0;
}

/*
 * Local Variables:
 * mode: c
 * End:
 */


Add an experimental/incomplete parser for macros.

// Experimental parser for macros
//
// TODO:
//
// - Store macros and keys nicely in a map
// - Expand queries, marked with percent signs.
// - If everything works, remove main.

#include <algorithm>
#include <fstream>
#include <iostream>
#include <iterator>
#include <sstream>
#include <cstring>

%%{
	machine macros;
	write data;
}%%

void parseMacros(char const *data)
{
	int cs = 0;
	char const *p = data;
	char const *pe = p + std::strlen(data);
	char const *eof = p + std::strlen(data);

	char const *strStart = p;
	char const *strEnd = eof;

	std::ostringstream buf;
%%{
	action str_char {
		buf << fc;
	}

	action key {
		std::cout << "key: " << buf.str() << std::endl;
		buf.str("");
	}

	action queryStart {
		strStart = p;
	}

	action queryEnd {
		std::string query(strStart, p - 3);
		std::cout << "value: " << query << std::endl;
	}

	separator = "\"\"\"";
	whitespace = [\n\r\t ]+;

	key = ([A-Za-z0-9_]+) $ str_char % key;

	query = (any* -- separator);
	queryVal = (separator % queryStart) query (separator % queryEnd);

	main := (whitespace* key whitespace* '=' whitespace* queryVal)*;

	write init;
	write exec;
}%%
}

int main(int argc, char const *argv[])
{
	if (argc != 2)
		return 1;

	std::ifstream in(argv[1]);
	if (!in)
		return 1;

	in >> std::noskipws;

	std::ostringstream iss;
	std::copy(std::istream_iterator<char>(in),
		std::istream_iterator<char>(),
		std::ostream_iterator<char>(iss));

	std::string data = iss.str();

	parseMacros(data.c_str());
}

error: pathspec 'src/macros.rl' did not match any file(s) known to git


* add missing file

* add missing file

(%
 % rowl - generation 2
 % Copyright (C) 2010 nineties
 %
 % $Id: startup.rl 2010-05-06 13:26:45 nineties $
 %)

import sys;
import main;

external __init__main! () -> ();

export
__start: () {
    __init__main();
    sys_exit(main());
};

error: pathspec 'rlc2/startup.rl' did not match any file(s) known to git


json/flat: don't try to parse empty files

avoids debug assertions fetching data pointer on empty mappings


make control "kill" command use Register_disconnect() rather than fdclose().

Previously it would leave a stale registration entry, and any new connections
that re-used that fd would get booted immediately.

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/msteinert/mongrel2.git/'


[Feature] Simplify machines by assuming that headers are unfolded

%%{
  machine smtp_whitespace;

  WSP             =   " ";
  CRLF            =   "\r\n" | ("\r" [^\n]) | ([^\r] "\n");
  DQUOTE = '"';

  # Printable US-ASCII characters not including specials
  atext = alpha | digit | "!" | "#" | "$" | "%" | "&" |
          "'" | "*" | "+" | "_" | "/" | "=" | "?" | "^" |
          "-" | "`" | "{" | "|" | "}" | "~";
  # Printable US-ASCII characters not including "[", "]", or "\"
  dtext = 33..90 | 94..126;
  # Printable US-ASCII characters not including  "(", ")", or "\"
  ctext = 33..39 | 42..91 | 93..126;

  dcontent       = 33..90 | 94..126;
  Let_dig        = alpha | digit;
  Ldh_str        = ( alpha | digit | "_" | "-" )* Let_dig;

  quoted_pairSMTP  = "\\" 32..126;
  qtextSMTP      = 32..33 | 35..91 | 93..126;
  Atom           = atext+;
  Dot_string     = Atom ("."  Atom)*;
  dot_atom_text  = atext+ ("." atext+)*;
  #FWS            =   ((WSP* CRLF)? WSP+);
  FWS            = WSP+; # We work with unfolded headers, so we can simplify machine

  comment        =   "(" (FWS? ctext)* FWS? ")";
  CFWS           =   ((FWS? comment)+ FWS?) | FWS;
}%%

%%{
  machine smtp_whitespace;

  WSP             =   " ";
  CRLF            =   "\r\n" | ("\r" [^\n]) | ([^\r] "\n");
  DQUOTE = '"';

  # Printable US-ASCII characters not including specials
  atext = alpha | digit | "!" | "#" | "$" | "%" | "&" |
          "'" | "*" | "+" | "_" | "/" | "=" | "?" | "^" |
          "-" | "`" | "{" | "|" | "}" | "~";
  # Printable US-ASCII characters not including "[", "]", or "\"
  dtext = 33..90 | 94..126;
  # Printable US-ASCII characters not including  "(", ")", or "\"
  ctext = 33..39 | 42..91 | 93..126;

  dcontent       = 33..90 | 94..126;
  Let_dig        = alpha | digit;
  Ldh_str        = ( alpha | digit | "_" | "-" )* Let_dig;

  quoted_pairSMTP  = "\\" 32..126;
  qtextSMTP      = 32..33 | 35..91 | 93..126;
  Atom           = atext+;
  Dot_string     = Atom ("."  Atom)*;
  dot_atom_text  = atext+ ("." atext+)*;
  FWS            =   ((WSP* CRLF)? WSP+);

  comment        =   "(" (FWS? ctext)* FWS? ")";
  CFWS           =   ((FWS? comment)+ FWS?) | FWS;
}%%


remove double 'null' occurrence

remove double 'null' occurrence

/*
 * See LICENSE file in distribution for copyright and licensing information.
 */
package org.yaml.snakeyaml.resolver;

public class RagelMachine {
    %%{
        machine snakeyaml;
        action bool_tag { tag = "tag:yaml.org,2002:bool"; }
        action merge_tag { tag = "tag:yaml.org,2002:merge"; }
        action null_tag { tag = "tag:yaml.org,2002:null"; }
        action value_tag { tag = "tag:yaml.org,2002:value"; }
        action int_tag { tag = "tag:yaml.org,2002:int"; }

        Bool = ("yes" | "Yes" | "YES" | "no" | "No" | "NO" |
                "true" | "True" | "TRUE" | "false" | "False" | "FALSE" |
                "on" | "On" | "ON" | "off" | "Off" | "OFF") %/bool_tag;
        Merge = "<<" %/merge_tag;
        Value = "=" %/value_tag;
        Null  = ("~" | "null" | "Null" | "NULL" | " ") %/null_tag;
        sign = "-" | "+";
        digit2 = digit | "_" | ",";
        binaryInt = "0b" [0-1_]+;
        octalInt = "0" [0-7_]+;
        decimalInt = "0" |
                     [1-9]digit2* (":" [0-5]? digit)*;
        hexaInt = "0x" [0-9a-fA-F_,]+;
        Int = sign? (binaryInt | octalInt | decimalInt | hexaInt) %/int_tag;

        Scalar = Bool | Null | Int | Merge | Value;
        main := Scalar;
    }%%

    %% write data nofinal;

    public String scan(String scalar) {
        if (scalar == null) {
            throw new NullPointerException("Scalar must be provided");
        }
        String tag = null;
        int cs = 0;
        int p = 0;
        int pe = scalar.length();
        int eof = pe;
        char[] data;
        if (pe == 0) {
            // NULL value
            data = new char[] { '~' };
            pe = 1;
        } else {
            data = scalar.toCharArray();
        }
        %%{
            # Initialize and execute.
            write init;
            write exec;
        }%%

        return tag;
    }
}

/*
 * See LICENSE file in distribution for copyright and licensing information.
 */
package org.yaml.snakeyaml.resolver;

public class RagelMachine {
    %%{
        machine snakeyaml;
        action bool_tag { tag = "tag:yaml.org,2002:bool"; }
        action merge_tag { tag = "tag:yaml.org,2002:merge"; }
        action null_tag { tag = "tag:yaml.org,2002:null"; }
        action value_tag { tag = "tag:yaml.org,2002:value"; }
        action int_tag { tag = "tag:yaml.org,2002:int"; }

        Bool = ("yes" | "Yes" | "YES" | "no" | "No" | "NO" |
                "true" | "True" | "TRUE" | "false" | "False" | "FALSE" |
                "on" | "On" | "ON" | "off" | "Off" | "OFF") %/bool_tag;
        Merge = "<<" %/merge_tag;
        Value = "=" %/value_tag;
        Null  = ("~" | "null" | "Null" | "null" | "NULL" | " ") %/null_tag;
        sign = "-" | "+";
        digit2 = digit | "_" | ",";
        binaryInt = "0b" [0-1_]+;
        octalInt = "0" [0-7_]+;
        decimalInt = "0" |
                     [1-9]digit2* (":" [0-5]? digit)*;
        hexaInt = "0x" [0-9a-fA-F_,]+;
        Int = sign? (binaryInt | octalInt | decimalInt | hexaInt) %/int_tag;

        Scalar = Bool | Null | Int | Merge | Value;
        main := Scalar;
    }%%

    %% write data nofinal;

    public String scan(String scalar) {
        if (scalar == null) {
            throw new NullPointerException("Scalar must be provided");
        }
        String tag = null;
        int cs = 0;
        int p = 0;
        int pe = scalar.length();
        int eof = pe;
        char[] data;
        if (pe == 0) {
            // NULL value
            data = new char[] { '~' };
            pe = 1;
        } else {
            data = scalar.toCharArray();
        }
        %%{
            # Initialize and execute.
            write init;
            write exec;
        }%%

        return tag;
    }
}