#
# DO NOT MODIFY!!!!
# This file is automatically generated by Racc 1.4.6
# from Racc grammer file "".
#

require 'racc/parser.rb'

$drbd = Hash.new()

class DrbdParser < Racc::Parser

module_eval(<<'...end drbd.rb.yy/module_eval...', 'drbd.rb.yy', 149)
	def parse(str)
		@yydebug = false
		@q = []
		until str.empty? || !str
			case str
			when /\A\s+/
			when /\Adisable-ip-verification/
				@q.push [:TK_DISABLE_IP_VERIFICATION, 'disable-ip-verification']
			when /\Ausage-count/
				@q.push [:TK_USAGE_COUNT, 'usage-count']
			when /\Adialog-refresh/
				@q.push [:TK_DIALOG_REFRESH, 'dialog-refresh']	
			when /\Aon-io-error/
				@q.push [:TK_ON_IO_ERROR, 'on-io-error']
			when /\Aglobal/
				@q.push [:TK_GLOBAL, 'global']
			when /\Aminor-count/
				@q.push [:TK_MINOR_COUNT, 'minor-count']
			when /\Aresource/
				@q.push [:TK_RESOURCE, 'resource']
			when /\Acommon/
				@q.push [:TK_COMMON, 'common']	
			when /\Aprotocol/
				@q.push [:TK_PROTOCOL, 'protocol']
			when /\Adisk\s*\{/
				@q.push [:TK_DISK_S, 'disk_s']
			when /\Adisk/
				@q.push [:TK_DISK, 'disk']
			when /\Anet/
				@q.push [:TK_NET, 'net']
			when /\Asyncer/
				@q.push [:TK_SYNCER, 'syncer']
			when /\Astartup/
				@q.push [:TK_STARTUP, 'startup']
			when /\Ahandlers/
				@q.push [:TK_HANDLERS, 'handlers']	
			when /\Afencing/
				@q.push [:TK_FENCING, 'fencing']	
			when /\Ause-bmbv/
				@q.push [:TK_USE_BMBV, 'use-bmbv']
			when /\Ano-disk-barrier/
				@q.push [:TK_NO_DISK_BARRIER, 'no-disk-barrier']
			when /\Ano-disk-flushes/
				@q.push [:TK_NO_DISK_FLUSHES, 'no-disk-flushes']
			when /\Ano-disk-drain/
				@q.push [:TK_NO_DISK_DRAIN, 'no-disk-drain']
			when /\Ano-md-flushes/
				@q.push [:TK_NO_MD_FLUSHES, 'no-md-flushes']
			when /\Amax-bio-bvecs/
				@q.push [:TK_MAX_BIO_BVECS, 'max-bio-bvecs']
			when /\Aping-timeout/
				@q.push [:TK_PING_TIMEOUT, 'ping-timeout']
			when /\Aallow-two-primaries/
				@q.push [:TK_ALLOW_TWO_PRIMARIES, 'allow-two-primaries']
			when /\Acram-hmac-alg/
				@q.push [:TK_CRAM_HMAC_ALG, 'cram-hmac-alg']
			when /\Ashared-secret/
				@q.push [:TK_SHARED_SECRET, 'shared-secret']
			when /\Aafter-sb-0pri/
				@q.push [:TK_AFTER_SB_0PRI, 'after-sb-0pri']
			when /\Aafter-sb-1pri/
				@q.push [:TK_AFTER_SB_0PRI, 'after-sb-1pri']
			when /\Aafter-sb-2pri/
				@q.push [:TK_AFTER_SB_0PRI, 'after-sb-2pri']
			when /\Adata-integrity-alg/
				@q.push [:TK_DATA_INTEGRITY_ALG, 'data-integrity-alg']	
			when /\Arr-conflict/
				@q.push [:TK_RR_CONFLICT, 'rr-conflict']
			when /\Apri-on-incon-degr/
				@q.push [:TK_PRI_ON_INCON_DEGR, 'pri-on-incon-degr']
			when /\Apri-lost-after-sb/
				@q.push [:TK_PRI_LOST_AFTER_SB, 'pri-lost-after-sb']
			when /\Apri-lost/
				@q.push [:TK_PRI_LOST, 'pri-lost']	
			when /\Aoutdate-peer/
				@q.push [:TK_OUTDATE_PEER, 'outdate-peer']
			when /\Alocal-io-error/
				@q.push [:TK_LOCAL_IO_ERROR, 'local-io-error']
			when /\Asplit-brain/
				@q.push [:TK_SPLIT_BRAIN, 'split-brain']
			when /\Abefore-resync-target/
				@q.push [:TK_BEFORE_RESYNC_TARGET, 'before-rsync-target']
			when /\Aafter-resync-target/
				@q.push [:TK_AFTER_RESYNC_TARGET, 'after-resync-target']
			when /\Await-after-sb/
				@q.push [:TK_WAIT_AFTER_SB, 'wait-after-sb']
			when /\Abecome-primary-on/
				@q.push [:TK_BECOME_PRIMARY_ON, 'become-primary-on']	
			when /\Ano-tcp-cork/
				@q.push [:TK_NO_TCP_CORK, 'no-tcp-cork']
			when /\Acpu-mask/
				@q.push [:TK_CPU_MASK, 'cpu-mask']
			when /\Averify-alg/
				@q.push [:TK_VERIFY_ALG, 'verify-alg']	
			when /\Asize/
				@q.push [:TK_SIZE, 'size']
			when /\Atimeout/
				@q.push [:TK_TIMEOUT, 'timeout']
			when /\Aconnect-int/
				@q.push [:TK_CONNECT_INT, 'connect-int']
			when /\Aafter-sb-0pri/
				@q.push [:TK_AFTER_SB_0PRI, 'after-sb-0pri']
			when /\Aafter-sb-1pri/
				@q.push [:TK_AFTER_SB_0PRI, 'after-sb-1pri']
			when /\Aafter-sb-2pri/
				@q.push [:TK_AFTER_SB_0PRI, 'after-sb-2pri']
			when /\Arr-conflict/
				@q.push [:TK_RR_CONFLICT, 'rr-conflict']	
			when /\Aping-int/
				@q.push [:TK_PING_INT, 'ping-int']
			when /\Amax-buffers/
				@q.push [:TK_MAX_BUFFERS, 'max-buffers']
			when /\Aunplug-watermark/
				@q.push [:TK_UNPLUG_WATERMARK, 'unplug-watermark']
			when /\Amax-epoch-size/
				@q.push [:TK_MAX_EPOCH_SIZE, 'max-epoch-size']
			when /\Asndbuf-size/
				@q.push [:TK_SNDBUF_SIZE, 'sndbuf-size']
			when /\Ako-count/
				@q.push [:TK_KO_COUNT, 'ko-count']
			when /\Arate/
				@q.push [:TK_RATE, 'rate']
			when /\Aal-extents/
				@q.push [:TK_AL_EXTENTS, 'al-extents']
			when /\Aafter/
				@q.push [:TK_AFTER, 'after']	
			when /\Adevice/
				@q.push [:TK_DEVICE, 'device']
			when /\Aaddress/
				@q.push [:TK_ADDRESS, 'address']
			when /\Ameta-disk/
				@q.push [:TK_META_DISK, 'meta-disk']
			when /\Aflexible-meta-disk/
				@q.push [:TK_FLEXIBLE_META_DISK, 'flexible-meta-disk']	
			when /\Adegr-wfc-timeout/
				@q.push [:TK_DEGR_WFC_TIMEOUT, 'degr-wfc-timeout']
			when /\Awfc-timeout/
				@q.push [:TK_WFC_TIMEOUT, 'wfc-timeout']
			when /\Aipv6/
				@q.push [:TK_IPV6, 'ipv6']	
			when /\Aon\s*/
				@q.push [:TK_ON, 'on']
			when /\A"[^"]*"/
				@q.push [:TK_STRING, $&]
			when /\A\[[\w\.\/:]+:[\w\.\/:]+\]/
				@q.push [:TK_IPV6ADDR, $&]	
			when /\A[\w\.\/\[\]-]+/
				@q.push [:TK_STRING, $&]
			when /\A.|\n/o
				s = $&
				@q.push [s, s]
			end
			str = $'
		end
		@q.push [false, '$end']	
		do_parse
	end

	def next_token
		@q.shift
	end	
			
...end drbd.rb.yy/module_eval...
##### State transition tables begin ###

racc_action_table = [
    68,    64,    63,    65,    66,   200,    59,   166,    62,    60,
    61,    26,    25,    27,    28,    38,    18,    39,   194,    36,
    34,    69,    19,   187,   185,   186,   188,    43,    44,    70,
    71,    72,    73,    67,    43,    44,   101,   105,    74,    75,
    76,    20,    17,    29,    77,   108,   111,    45,    46,    47,
    48,    49,    50,    51,    45,    46,    47,    48,    49,    50,
    51,    78,   199,   102,   103,   104,   108,   111,    56,    33,
   189,   195,    32,    31,    30,   122,   123,   124,    23,    15,
    99,   172,   109,   110,   183,   126,   127,   106,    41,    81,
    82,    83,    85,   129,    86,    87,    88,   130,   131,   132,
   134,    89,   135,   109,   110,   136,   137,   138,   180,   139,
   140,   141,   142,   143,    84,    90,    91,    92,    93,    94,
    95,    96,    97,    98,    81,    82,    83,    85,   144,    86,
    87,    88,   145,   101,   105,   146,    89,   147,   148,   149,
   150,   178,   151,   152,   153,   154,   155,   156,   157,    84,
    90,    91,    92,    93,    94,    95,    96,    97,    98,   158,
   102,   103,   104,   159,   160,   114,   115,   116,   117,   118,
   119,   120,   121,   161,   162,   163,    79,   179,   181,   114,
   115,   116,   117,   118,   119,   120,   121,   164,   165,    37,
   167,   168,   112,   169,   170,   171,    22,   177,     3,    13,
    10,     8,     7,   190,   191,   192,     6,   126,   198,     4,
   201,   202,   203,   204,   205,   206 ]

racc_action_check = [
    40,    40,    40,    40,    40,   194,    40,   117,    40,    40,
    40,    14,    14,    14,    14,    28,    11,    29,   187,    26,
    21,    42,    11,   182,   182,   182,   182,   128,   128,    43,
    44,    45,    46,    40,    35,    35,    53,    53,    47,    48,
    49,    11,    11,    14,    50,    54,    54,   128,   128,   128,
   128,   128,   128,   128,    35,    35,    35,    35,    35,    35,
    35,    51,   194,    53,    53,    53,   175,   175,    40,    20,
   182,   187,    19,    17,    16,    57,    59,    60,    14,    11,
    53,   128,    54,    54,   182,    61,    62,    54,    35,   173,
   173,   173,   173,    64,   173,   173,   173,    65,    66,    67,
    68,   173,    80,   175,   175,    81,    82,    83,   175,    84,
    85,    86,    87,    88,   173,   173,   173,   173,   173,   173,
   173,   173,   173,   173,    52,    52,    52,    52,    89,    52,
    52,    52,    91,   174,   174,    92,    52,    93,    94,    95,
    96,   173,    97,   100,   101,   102,   103,   104,   105,    52,
    52,    52,    52,    52,    52,    52,    52,    52,    52,   107,
   174,   174,   174,   108,   110,   176,   176,   176,   176,   176,
   176,   176,   176,   111,   113,   114,    52,   174,   176,    55,
    55,    55,    55,    55,    55,    55,    55,   115,   116,    27,
   118,   119,    55,   120,   121,   126,    13,   133,     0,     9,
     6,     4,     3,   184,   185,   186,     2,   188,   189,     1,
   195,   199,   200,   201,   203,   204 ]

racc_action_pointer = [
   196,   209,   170,   131,   201,   nil,   129,   nil,   nil,   196,
   nil,     7,   nil,   179,     6,   nil,     1,    56,   nil,    55,
    52,   -51,   nil,   nil,   nil,   nil,   -52,   118,   -56,   -54,
   nil,   nil,   nil,   nil,   nil,    16,   nil,   nil,   nil,   nil,
    -4,   nil,   -52,    12,    13,    14,    15,    21,    22,    23,
    27,    44,   104,     8,    15,   120,   nil,     2,   nil,    59,
    60,    68,    69,   nil,    22,    26,    27,    28,    83,   nil,
   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
    29,    88,    89,    90,    92,    93,    94,    95,    96,   111,
   nil,   115,   118,   120,   121,   122,   123,   125,   nil,   nil,
    70,   127,   128,   129,   130,   131,   nil,    86,   146,   nil,
   147,   156,   nil,   101,   158,   170,   171,   -10,   173,   174,
   176,   177,   nil,   nil,   nil,   nil,   178,   nil,     9,   nil,
   nil,   nil,   nil,   126,   nil,   nil,   nil,   nil,   nil,   nil,
   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
   nil,   nil,   nil,    69,   105,    36,   106,   nil,   nil,   nil,
   nil,   nil,    12,   nil,   130,   187,   188,     1,   190,   191,
   nil,   nil,   nil,   nil,   -12,   141,   nil,   nil,   nil,   194,
   138,   139,   nil,   197,   198,   nil,   nil ]

racc_action_default = [
    -2,  -104,   -10,  -104,  -104,   -19,  -104,    -4,   207,    -1,
   -12,  -104,   -20,  -104,  -104,    -3,  -104,  -104,    -7,  -104,
  -104,  -104,   -22,   -11,   -13,   -37,  -104,  -104,  -104,  -104,
    -5,    -6,    -8,    -9,   -23,  -104,   -48,   -68,   -98,   -82,
  -104,   -14,  -104,  -104,  -104,  -104,  -104,  -104,  -104,  -104,
  -104,  -104,  -104,  -104,  -104,  -104,   -21,  -104,   -25,  -104,
  -104,  -104,  -104,   -37,  -104,  -104,  -104,  -104,  -104,   -38,
   -39,   -40,   -41,   -42,   -43,   -44,   -45,   -46,   -47,   -15,
  -104,  -104,  -104,  -104,  -104,  -104,  -104,  -104,  -104,  -104,
   -59,  -104,  -104,  -104,  -104,  -104,  -104,  -104,   -67,   -16,
  -104,  -104,  -104,  -104,  -104,  -104,   -17,  -104,  -104,  -101,
  -104,  -104,   -18,  -104,  -104,  -104,  -104,  -104,  -104,  -104,
  -104,  -104,   -24,   -26,   -27,   -28,   -96,   -29,  -104,   -48,
   -68,   -98,   -82,  -104,   -36,   -49,   -50,   -51,   -52,   -53,
   -54,   -55,   -56,   -57,   -58,   -60,   -61,   -62,   -63,   -64,
   -65,   -66,   -69,   -70,   -71,   -72,   -73,   -74,   -99,  -100,
  -102,  -103,   -83,   -84,   -85,   -86,   -87,   -88,   -89,   -90,
   -91,   -95,   -30,  -104,  -104,  -104,  -104,   -75,   -31,   -32,
   -33,   -34,  -104,   -35,  -104,  -104,  -104,  -104,  -104,  -104,
   -76,   -77,   -78,   -79,  -104,  -104,   -80,   -81,   -97,  -104,
  -104,  -104,   -92,  -104,  -104,   -94,   -93 ]

racc_goto_table = [
   125,    54,    55,    52,    53,    35,     1,    24,    16,    11,
     9,     5,    14,    12,    21,    40,    57,    58,     2,   133,
   182,   184,   193,   197,   nil,   nil,   nil,   nil,   nil,   nil,
   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
   nil,   nil,   nil,   128,   nil,   nil,   nil,   nil,   nil,   nil,
   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
   nil,   nil,   nil,   nil,   175,   176,   173,   174,   nil,   nil,
   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
   nil,   nil,   nil,   nil,   nil,   nil,   nil,   196 ]

racc_goto_check = [
    19,    12,    13,    10,    11,     9,     1,     8,     6,     5,
     4,     3,     7,    14,    15,    16,    17,    18,     2,    20,
    21,    25,    26,    27,   nil,   nil,   nil,   nil,   nil,   nil,
   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
   nil,   nil,   nil,     9,   nil,   nil,   nil,   nil,   nil,   nil,
   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
   nil,   nil,   nil,   nil,    12,    13,    10,    11,   nil,   nil,
   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
   nil,   nil,   nil,   nil,   nil,   nil,   nil,    19 ]

racc_goto_pointer = [
   nil,     6,    18,     9,     5,     2,    -3,     2,    -7,   -20,
   -33,   -33,   -37,   -37,     4,     1,   -19,   -24,   -23,   -61,
   -49,  -157,   nil,   nil,   nil,  -161,  -165,  -166,   nil,   nil ]

racc_goto_default = [
   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
   nil,   nil,    42,    80,   100,   nil,   nil,   nil,   113,   107 ]

racc_reduce_table = [
  0, 0, :racc_error,
  3, 76, :_reduce_1,
  0, 77, :_reduce_2,
  4, 77, :_reduce_3,
  0, 80, :_reduce_4,
  3, 80, :_reduce_5,
  2, 81, :_reduce_6,
  1, 81, :_reduce_7,
  2, 81, :_reduce_8,
  2, 81, :_reduce_9,
  0, 78, :_reduce_10,
  4, 78, :_reduce_11,
  0, 82, :_reduce_12,
  2, 82, :_reduce_13,
  3, 83, :_reduce_14,
  4, 83, :_reduce_15,
  4, 83, :_reduce_16,
  4, 83, :_reduce_17,
  4, 83, :_reduce_18,
  0, 79, :_reduce_19,
  2, 79, :_reduce_20,
  5, 89, :_reduce_21,
  1, 90, :_reduce_22,
  0, 91, :_reduce_23,
  3, 91, :_reduce_24,
  2, 91, :_reduce_25,
  2, 92, :_reduce_26,
  2, 92, :_reduce_27,
  2, 92, :_reduce_28,
  2, 92, :_reduce_29,
  3, 93, :_reduce_30,
  4, 93, :_reduce_31,
  4, 93, :_reduce_32,
  4, 93, :_reduce_33,
  4, 93, :_reduce_34,
  5, 93, :_reduce_35,
  1, 95, :_reduce_36,
  0, 84, :_reduce_37,
  3, 84, :_reduce_38,
  2, 97, :_reduce_39,
  2, 97, :_reduce_40,
  2, 97, :_reduce_41,
  2, 97, :_reduce_42,
  2, 97, :_reduce_43,
  2, 97, :_reduce_44,
  2, 97, :_reduce_45,
  2, 97, :_reduce_46,
  2, 97, :_reduce_47,
  0, 85, :_reduce_48,
  3, 85, :_reduce_49,
  2, 98, :_reduce_50,
  2, 98, :_reduce_51,
  2, 98, :_reduce_52,
  2, 98, :_reduce_53,
  2, 98, :_reduce_54,
  2, 98, :_reduce_55,
  2, 98, :_reduce_56,
  2, 98, :_reduce_57,
  2, 98, :_reduce_58,
  1, 98, :_reduce_59,
  2, 98, :_reduce_60,
  2, 98, :_reduce_61,
  2, 98, :_reduce_62,
  2, 98, :_reduce_63,
  2, 98, :_reduce_64,
  2, 98, :_reduce_65,
  2, 98, :_reduce_66,
  1, 98, :_reduce_67,
  0, 86, :_reduce_68,
  3, 86, :_reduce_69,
  2, 99, :_reduce_70,
  2, 99, :_reduce_71,
  2, 99, :_reduce_72,
  2, 99, :_reduce_73,
  2, 99, :_reduce_74,
  0, 96, :_reduce_75,
  3, 96, :_reduce_76,
  2, 100, :_reduce_77,
  2, 100, :_reduce_78,
  2, 100, :_reduce_79,
  2, 100, :_reduce_80,
  2, 100, :_reduce_81,
  0, 88, :_reduce_82,
  3, 88, :_reduce_83,
  2, 103, :_reduce_84,
  2, 103, :_reduce_85,
  2, 103, :_reduce_86,
  2, 103, :_reduce_87,
  2, 103, :_reduce_88,
  2, 103, :_reduce_89,
  2, 103, :_reduce_90,
  2, 103, :_reduce_91,
  3, 101, :_reduce_92,
  4, 101, :_reduce_93,
  4, 101, :_reduce_94,
  2, 94, :_reduce_95,
  1, 94, :_reduce_96,
  1, 102, :_reduce_97,
  0, 87, :_reduce_98,
  3, 87, :_reduce_99,
  2, 104, :_reduce_100,
  1, 104, :_reduce_101,
  2, 104, :_reduce_102,
  2, 104, :_reduce_103 ]

racc_reduce_n = 104

racc_shift_n = 207

racc_token_table = {
  false => 0,
  :error => 1,
  :TK_GLOBAL => 2,
  :TK_RESOURCE => 3,
  :TK_ON => 4,
  :TK_NET => 5,
  :TK_DISK_S => 6,
  :TK_SYNCER => 7,
  :TK_STARTUP => 8,
  :TK_DISABLE_IP_VERIFICATION => 9,
  :TK_PROTOCOL => 10,
  :TK_ADDRESS => 11,
  :TK_DISK => 12,
  :TK_DEVICE => 13,
  :TK_META_DISK => 14,
  :TK_MINOR_COUNT => 15,
  :TK_INTEGER => 16,
  :TK_STRING => 17,
  :TK_ON_IO_ERROR => 18,
  :TK_SIZE => 19,
  :TK_TIMEOUT => 20,
  :TK_CONNECT_INT => 21,
  :TK_PING_INT => 22,
  :TK_MAX_BUFFERS => 23,
  :TK_IPADDR => 24,
  :TK_UNPLUG_WATERMARK => 25,
  :TK_MAX_EPOCH_SIZE => 26,
  :TK_SNDBUF_SIZE => 27,
  :TK_RATE => 28,
  :TK_AL_EXTENTS => 29,
  :TK_WFC_TIMEOUT => 30,
  :TK_DEGR_WFC_TIMEOUT => 31,
  :TK_KO_COUNT => 32,
  :TK_ON_DISCONNECT => 33,
  :TK_DIALOG_REFRESH => 34,
  :TK_USAGE_COUNT => 35,
  :TK_COMMON => 36,
  :TK_HANDLERS => 37,
  :TK_FENCING => 38,
  :TK_USE_BMBV => 39,
  :TK_NO_DISK_BARRIER => 40,
  :TK_NO_DISK_FLUSHES => 41,
  :TK_NO_DISK_DRAIN => 42,
  :TK_NO_MD_FLUSHES => 43,
  :TK_MAX_BIO_BVECS => 44,
  :TK_PINT_TIMEOUT => 45,
  :TK_ALLOW_TWO_PRIMARIES => 46,
  :TK_CRAM_HMAC_ALG => 47,
  :TK_SHARED_SECRET => 48,
  :TK_AFTER_SB_0PRI => 49,
  :TK_AFTER_SB_1PRI => 50,
  :TK_AFTER_SB_2PRI => 51,
  :TK_DATA_INTEGRITY_ALG => 52,
  :TK_RR_CONFLICT => 53,
  :TK_NO_TCP_CORK => 54,
  :TK_CPU_MASK => 55,
  :TK_VERIFY_ALG => 56,
  :TK_AFTER => 57,
  :TK_FLEXIBLE_META_DISK => 58,
  :TK_PRI_ON_INCON_DEGR => 59,
  :TK_PRI_LOST_AFTER_SB => 60,
  :TK_PRI_LOST => 61,
  :TK_OUTDATE_PEER => 62,
  :TK_LOCAL_IO_ERROR => 63,
  :TK_SPLIT_BRAIN => 64,
  :TK_BEFORE_RESYNC_TARGET => 65,
  :TK_AFTER_RESYNC_TARGET => 66,
  :TK_WAIT_AFTER_SB => 67,
  :TK_BECOME_PRIMARY_ON => 68,
  :TK_IPV6ADDR => 69,
  :TK_IPV6 => 70,
  "{" => 71,
  "}" => 72,
  ";" => 73,
  ":" => 74 }

racc_nt_base = 75

racc_use_result_var = true

Racc_arg = [
  racc_action_table,
  racc_action_check,
  racc_action_default,
  racc_action_pointer,
  racc_goto_table,
  racc_goto_check,
  racc_goto_default,
  racc_goto_pointer,
  racc_nt_base,
  racc_reduce_table,
  racc_token_table,
  racc_shift_n,
  racc_reduce_n,
  racc_use_result_var ]

Racc_token_to_s_table = [
  "$end",
  "error",
  "TK_GLOBAL",
  "TK_RESOURCE",
  "TK_ON",
  "TK_NET",
  "TK_DISK_S",
  "TK_SYNCER",
  "TK_STARTUP",
  "TK_DISABLE_IP_VERIFICATION",
  "TK_PROTOCOL",
  "TK_ADDRESS",
  "TK_DISK",
  "TK_DEVICE",
  "TK_META_DISK",
  "TK_MINOR_COUNT",
  "TK_INTEGER",
  "TK_STRING",
  "TK_ON_IO_ERROR",
  "TK_SIZE",
  "TK_TIMEOUT",
  "TK_CONNECT_INT",
  "TK_PING_INT",
  "TK_MAX_BUFFERS",
  "TK_IPADDR",
  "TK_UNPLUG_WATERMARK",
  "TK_MAX_EPOCH_SIZE",
  "TK_SNDBUF_SIZE",
  "TK_RATE",
  "TK_AL_EXTENTS",
  "TK_WFC_TIMEOUT",
  "TK_DEGR_WFC_TIMEOUT",
  "TK_KO_COUNT",
  "TK_ON_DISCONNECT",
  "TK_DIALOG_REFRESH",
  "TK_USAGE_COUNT",
  "TK_COMMON",
  "TK_HANDLERS",
  "TK_FENCING",
  "TK_USE_BMBV",
  "TK_NO_DISK_BARRIER",
  "TK_NO_DISK_FLUSHES",
  "TK_NO_DISK_DRAIN",
  "TK_NO_MD_FLUSHES",
  "TK_MAX_BIO_BVECS",
  "TK_PINT_TIMEOUT",
  "TK_ALLOW_TWO_PRIMARIES",
  "TK_CRAM_HMAC_ALG",
  "TK_SHARED_SECRET",
  "TK_AFTER_SB_0PRI",
  "TK_AFTER_SB_1PRI",
  "TK_AFTER_SB_2PRI",
  "TK_DATA_INTEGRITY_ALG",
  "TK_RR_CONFLICT",
  "TK_NO_TCP_CORK",
  "TK_CPU_MASK",
  "TK_VERIFY_ALG",
  "TK_AFTER",
  "TK_FLEXIBLE_META_DISK",
  "TK_PRI_ON_INCON_DEGR",
  "TK_PRI_LOST_AFTER_SB",
  "TK_PRI_LOST",
  "TK_OUTDATE_PEER",
  "TK_LOCAL_IO_ERROR",
  "TK_SPLIT_BRAIN",
  "TK_BEFORE_RESYNC_TARGET",
  "TK_AFTER_RESYNC_TARGET",
  "TK_WAIT_AFTER_SB",
  "TK_BECOME_PRIMARY_ON",
  "TK_IPV6ADDR",
  "TK_IPV6",
  "\"{\"",
  "\"}\"",
  "\";\"",
  "\":\"",
  "$start",
  "config",
  "global_sec",
  "common_sec",
  "resources",
  "glob_stmts",
  "glob_stmt",
  "common_stmts",
  "common_stmt",
  "disk_stmts",
  "net_stmts",
  "sync_stmts",
  "startup_stmts",
  "handlers_stmts",
  "resource",
  "resource_name",
  "res_stmts",
  "res_stmt",
  "section",
  "meta_disk_and_index",
  "hostname",
  "host_stmts",
  "disk_stmt",
  "net_stmt",
  "sync_stmt",
  "host_stmt",
  "ip_and_port",
  "flexible_meta_disk",
  "handlers_stmt",
  "startup_stmt" ]

Racc_debug_parser = true

##### State transition tables end #####

# reduce 0 omitted

module_eval(<<'.,.,', 'drbd.rb.yy', 6)
  def _reduce_1(val, _values, result)
     $drbd['global'] = val[0]; $drbd['common'] = val[1]; $drbd['resources'] = val[2]; return $drbd; 
    result
  end
.,.,

module_eval(<<'.,.,', 'drbd.rb.yy', 8)
  def _reduce_2(val, _values, result)
     return {}; 
    result
  end
.,.,

module_eval(<<'.,.,', 'drbd.rb.yy', 9)
  def _reduce_3(val, _values, result)
     return val[2]; 
    result
  end
.,.,

module_eval(<<'.,.,', 'drbd.rb.yy', 10)
  def _reduce_4(val, _values, result)
     return {}; 
    result
  end
.,.,

module_eval(<<'.,.,', 'drbd.rb.yy', 11)
  def _reduce_5(val, _values, result)
     nk = val[1][0]; val[0][nk] = val[1][1]; return val[0]; 
    result
  end
.,.,

module_eval(<<'.,.,', 'drbd.rb.yy', 12)
  def _reduce_6(val, _values, result)
     return ["#{val[0]}", val[1]]; 
    result
  end
.,.,

module_eval(<<'.,.,', 'drbd.rb.yy', 13)
  def _reduce_7(val, _values, result)
     return ["#{val[0]}", true]; 
    result
  end
.,.,

module_eval(<<'.,.,', 'drbd.rb.yy', 14)
  def _reduce_8(val, _values, result)
     return ["#{val[0]}", val[1]]; 
    result
  end
.,.,

module_eval(<<'.,.,', 'drbd.rb.yy', 15)
  def _reduce_9(val, _values, result)
     return ["#{val[0]}", val[1]];
    result
  end
.,.,

module_eval(<<'.,.,', 'drbd.rb.yy', 17)
  def _reduce_10(val, _values, result)
     return {}; 
    result
  end
.,.,

module_eval(<<'.,.,', 'drbd.rb.yy', 18)
  def _reduce_11(val, _values, result)
     return val[2]; 
    result
  end
.,.,

module_eval(<<'.,.,', 'drbd.rb.yy', 19)
  def _reduce_12(val, _values, result)
     return {}; 
    result
  end
.,.,

module_eval(<<'.,.,', 'drbd.rb.yy', 20)
  def _reduce_13(val, _values, result)
     nk = val[1][0]; val[0][nk] = val[1][1]; return val[0]; 
    result
  end
.,.,

module_eval(<<'.,.,', 'drbd.rb.yy', 22)
  def _reduce_14(val, _values, result)
     return ["#{val[0]}", val[1]]; 
    result
  end
.,.,

module_eval(<<'.,.,', 'drbd.rb.yy', 23)
  def _reduce_15(val, _values, result)
     return ["#{val[0]}", val[2]]; 
    result
  end
.,.,

module_eval(<<'.,.,', 'drbd.rb.yy', 24)
  def _reduce_16(val, _values, result)
     return ["#{val[0]}", val[2]]; 
    result
  end
.,.,

module_eval(<<'.,.,', 'drbd.rb.yy', 25)
  def _reduce_17(val, _values, result)
     return ["#{val[0]}", val[2]]; 
    result
  end
.,.,

module_eval(<<'.,.,', 'drbd.rb.yy', 26)
  def _reduce_18(val, _values, result)
     return ["#{val[0]}", val[2]]; 
    result
  end
.,.,

module_eval(<<'.,.,', 'drbd.rb.yy', 28)
  def _reduce_19(val, _values, result)
     return {}; 
    result
  end
.,.,

module_eval(<<'.,.,', 'drbd.rb.yy', 29)
  def _reduce_20(val, _values, result)
     nk = val[1][0]; val[0][nk] = val[1][1]; return val[0]; 
    result
  end
.,.,

module_eval(<<'.,.,', 'drbd.rb.yy', 31)
  def _reduce_21(val, _values, result)
     return ["#{val[1]}", val[3]]; 
    result
  end
.,.,

module_eval(<<'.,.,', 'drbd.rb.yy', 33)
  def _reduce_22(val, _values, result)
     return val[0]; 
    result
  end
.,.,

module_eval(<<'.,.,', 'drbd.rb.yy', 35)
  def _reduce_23(val, _values, result)
     return {}; 
    result
  end
.,.,

module_eval(<<'.,.,', 'drbd.rb.yy', 36)
  def _reduce_24(val, _values, result)
     nk = val[1][0]; val[0][nk] = val[1][1]; return val[0]; 
    result
  end
.,.,

module_eval(<<'.,.,', 'drbd.rb.yy', 37)
  def _reduce_25(val, _values, result)
    nk = val[1][0]; 
                                  if nk == "on" then 
				      if (!val[0]["on"]) then val[0]["on"] = {}; end
                                      val[0]["on"][val[1][1]] = val[1][2];  
                                  else
                                      val[0][nk] = val[1][1]; 
                                  end
                                  return val[0]; 
    result
  end
.,.,

module_eval(<<'.,.,', 'drbd.rb.yy', 46)
  def _reduce_26(val, _values, result)
     return ["#{val[0]}", val[1]]; 
    result
  end
.,.,

module_eval(<<'.,.,', 'drbd.rb.yy', 47)
  def _reduce_27(val, _values, result)
     return ["#{val[0]}", val[1]]; 
    result
  end
.,.,

module_eval(<<'.,.,', 'drbd.rb.yy', 48)
  def _reduce_28(val, _values, result)
     return ["#{val[0]}", val[1]]; 
    result
  end
.,.,

module_eval(<<'.,.,', 'drbd.rb.yy', 49)
  def _reduce_29(val, _values, result)
     return ["#{val[0]}", val[1]]; 
    result
  end
.,.,

module_eval(<<'.,.,', 'drbd.rb.yy', 51)
  def _reduce_30(val, _values, result)
     return ["#{val[0]}", val[1]]; 
    result
  end
.,.,

module_eval(<<'.,.,', 'drbd.rb.yy', 52)
  def _reduce_31(val, _values, result)
     return ["#{val[0]}", val[2]]; 
    result
  end
.,.,

module_eval(<<'.,.,', 'drbd.rb.yy', 53)
  def _reduce_32(val, _values, result)
     return ["#{val[0]}", val[2]]; 
    result
  end
.,.,

module_eval(<<'.,.,', 'drbd.rb.yy', 54)
  def _reduce_33(val, _values, result)
     return ["#{val[0]}", val[2]]; 
    result
  end
.,.,

module_eval(<<'.,.,', 'drbd.rb.yy', 55)
  def _reduce_34(val, _values, result)
     return ["#{val[0]}", val[2]]; 
    result
  end
.,.,

module_eval(<<'.,.,', 'drbd.rb.yy', 56)
  def _reduce_35(val, _values, result)
     return ["#{val[0]}", "#{val[1]}", val[3]]; 
    result
  end
.,.,

module_eval(<<'.,.,', 'drbd.rb.yy', 58)
  def _reduce_36(val, _values, result)
     return val[0]; 
    result
  end
.,.,

module_eval(<<'.,.,', 'drbd.rb.yy', 60)
  def _reduce_37(val, _values, result)
     return {}; 
    result
  end
.,.,

module_eval(<<'.,.,', 'drbd.rb.yy', 61)
  def _reduce_38(val, _values, result)
     nk = val[1][0]; val[0][nk] = val[1][1]; return val[0]; 
    result
  end
.,.,

module_eval(<<'.,.,', 'drbd.rb.yy', 63)
  def _reduce_39(val, _values, result)
     return ["#{val[0]}", val[1]]; 
    result
  end
.,.,

module_eval(<<'.,.,', 'drbd.rb.yy', 64)
  def _reduce_40(val, _values, result)
     return ["#{val[0]}", val[1]]; 
    result
  end
.,.,

module_eval(<<'.,.,', 'drbd.rb.yy', 65)
  def _reduce_41(val, _values, result)
     return ["#{val[0]}", val[1]]; 
    result
  end
.,.,

module_eval(<<'.,.,', 'drbd.rb.yy', 66)
  def _reduce_42(val, _values, result)
     return ["#{val[0]}", val[1]]; 
    result
  end
.,.,

module_eval(<<'.,.,', 'drbd.rb.yy', 67)
  def _reduce_43(val, _values, result)
     return ["#{val[0]}", val[1]]; 
    result
  end
.,.,

module_eval(<<'.,.,', 'drbd.rb.yy', 68)
  def _reduce_44(val, _values, result)
     return ["#{val[0]}", val[1]]; 
    result
  end
.,.,

module_eval(<<'.,.,', 'drbd.rb.yy', 69)
  def _reduce_45(val, _values, result)
     return ["#{val[0]}", val[1]]; 
    result
  end
.,.,

module_eval(<<'.,.,', 'drbd.rb.yy', 70)
  def _reduce_46(val, _values, result)
     return ["#{val[0]}", val[1]]; 
    result
  end
.,.,

module_eval(<<'.,.,', 'drbd.rb.yy', 71)
  def _reduce_47(val, _values, result)
     return ["#{val[0]}", val[1]]; 
    result
  end
.,.,

module_eval(<<'.,.,', 'drbd.rb.yy', 73)
  def _reduce_48(val, _values, result)
     return {}; 
    result
  end
.,.,

module_eval(<<'.,.,', 'drbd.rb.yy', 74)
  def _reduce_49(val, _values, result)
     nk = val[1][0]; val[0][nk] = val[1][1]; return val[0]; 
    result
  end
.,.,

module_eval(<<'.,.,', 'drbd.rb.yy', 76)
  def _reduce_50(val, _values, result)
     return ["#{val[0]}", val[1]]; 
    result
  end
.,.,

module_eval(<<'.,.,', 'drbd.rb.yy', 77)
  def _reduce_51(val, _values, result)
     return ["#{val[0]}", val[1]]; 
    result
  end
.,.,

module_eval(<<'.,.,', 'drbd.rb.yy', 78)
  def _reduce_52(val, _values, result)
     return ["#{val[0]}", val[1]]; 
    result
  end
.,.,

module_eval(<<'.,.,', 'drbd.rb.yy', 79)
  def _reduce_53(val, _values, result)
     return ["#{val[0]}", val[1]]; 
    result
  end
.,.,

module_eval(<<'.,.,', 'drbd.rb.yy', 80)
  def _reduce_54(val, _values, result)
     return ["#{val[0]}", val[1]]; 
    result
  end
.,.,

module_eval(<<'.,.,', 'drbd.rb.yy', 81)
  def _reduce_55(val, _values, result)
     return ["#{val[0]}", val[1]]; 
    result
  end
.,.,

module_eval(<<'.,.,', 'drbd.rb.yy', 82)
  def _reduce_56(val, _values, result)
     return ["#{val[0]}", val[1]]; 
    result
  end
.,.,

module_eval(<<'.,.,', 'drbd.rb.yy', 83)
  def _reduce_57(val, _values, result)
     return ["#{val[0]}", val[1]]; 
    result
  end
.,.,

module_eval(<<'.,.,', 'drbd.rb.yy', 84)
  def _reduce_58(val, _values, result)
     return ["#{val[0]}", val[1]]; 
    result
  end
.,.,

module_eval(<<'.,.,', 'drbd.rb.yy', 85)
  def _reduce_59(val, _values, result)
     return ["#{val[0]}", true]; 
    result
  end
.,.,

module_eval(<<'.,.,', 'drbd.rb.yy', 86)
  def _reduce_60(val, _values, result)
     return ["#{val[0]}", val[1]]; 
    result
  end
.,.,

module_eval(<<'.,.,', 'drbd.rb.yy', 87)
  def _reduce_61(val, _values, result)
     return ["#{val[0]}", val[1]]; 
    result
  end
.,.,

module_eval(<<'.,.,', 'drbd.rb.yy', 88)
  def _reduce_62(val, _values, result)
     return ["#{val[0]}", val[1]]; 
    result
  end
.,.,

module_eval(<<'.,.,', 'drbd.rb.yy', 89)
  def _reduce_63(val, _values, result)
     return ["#{val[0]}", val[1]]; 
    result
  end
.,.,

module_eval(<<'.,.,', 'drbd.rb.yy', 90)
  def _reduce_64(val, _values, result)
     return ["#{val[0]}", val[1]]; 
    result
  end
.,.,

module_eval(<<'.,.,', 'drbd.rb.yy', 91)
  def _reduce_65(val, _values, result)
     return ["#{val[0]}", val[1]]; 
    result
  end
.,.,

module_eval(<<'.,.,', 'drbd.rb.yy', 92)
  def _reduce_66(val, _values, result)
     return ["#{val[0]}", val[1]]; 
    result
  end
.,.,

module_eval(<<'.,.,', 'drbd.rb.yy', 93)
  def _reduce_67(val, _values, result)
     return ["#{val[0]}", true]; 
    result
  end
.,.,

module_eval(<<'.,.,', 'drbd.rb.yy', 95)
  def _reduce_68(val, _values, result)
     return {}; 
    result
  end
.,.,

module_eval(<<'.,.,', 'drbd.rb.yy', 96)
  def _reduce_69(val, _values, result)
     nk = val[1][0]; val[0][nk] = val[1][1]; return val[0]; 
    result
  end
.,.,

module_eval(<<'.,.,', 'drbd.rb.yy', 98)
  def _reduce_70(val, _values, result)
     return ["#{val[0]}", val[1]]; 
    result
  end
.,.,

module_eval(<<'.,.,', 'drbd.rb.yy', 99)
  def _reduce_71(val, _values, result)
     return ["#{val[0]}", vavl[1]]; 
    result
  end
.,.,

module_eval(<<'.,.,', 'drbd.rb.yy', 100)
  def _reduce_72(val, _values, result)
     return ["#{val[0]}", val[1]]; 
    result
  end
.,.,

module_eval(<<'.,.,', 'drbd.rb.yy', 101)
  def _reduce_73(val, _values, result)
     return ["#{val[0]}", val[1]]; 
    result
  end
.,.,

module_eval(<<'.,.,', 'drbd.rb.yy', 102)
  def _reduce_74(val, _values, result)
     return ["#{val[0]}", val[1]]; 
    result
  end
.,.,

module_eval(<<'.,.,', 'drbd.rb.yy', 104)
  def _reduce_75(val, _values, result)
     return {}; 
    result
  end
.,.,

module_eval(<<'.,.,', 'drbd.rb.yy', 105)
  def _reduce_76(val, _values, result)
     nk = val[1][0]; val[0][nk] = val[1][1]; return val[0]; 
    result
  end
.,.,

module_eval(<<'.,.,', 'drbd.rb.yy', 107)
  def _reduce_77(val, _values, result)
     return ["#{val[0]}", val[1]]; 
    result
  end
.,.,

module_eval(<<'.,.,', 'drbd.rb.yy', 108)
  def _reduce_78(val, _values, result)
     return ["#{val[0]}", val[1]]; 
    result
  end
.,.,

module_eval(<<'.,.,', 'drbd.rb.yy', 109)
  def _reduce_79(val, _values, result)
     return ["#{val[0]}", val[1]]; 
    result
  end
.,.,

module_eval(<<'.,.,', 'drbd.rb.yy', 110)
  def _reduce_80(val, _values, result)
     return ["#{val[0]}", val[1]]; 
    result
  end
.,.,

module_eval(<<'.,.,', 'drbd.rb.yy', 111)
  def _reduce_81(val, _values, result)
     return ["#{val[0]}", val[1]]; 
    result
  end
.,.,

module_eval(<<'.,.,', 'drbd.rb.yy', 113)
  def _reduce_82(val, _values, result)
     return {}; 
    result
  end
.,.,

module_eval(<<'.,.,', 'drbd.rb.yy', 114)
  def _reduce_83(val, _values, result)
     nk = val[1][0]; val[0][nk] = val[1][1]; return val[0]; 
    result
  end
.,.,

module_eval(<<'.,.,', 'drbd.rb.yy', 116)
  def _reduce_84(val, _values, result)
     return ["#{val[0]}", val[1]]; 
    result
  end
.,.,

module_eval(<<'.,.,', 'drbd.rb.yy', 117)
  def _reduce_85(val, _values, result)
     return ["#{val[0]}", val[1]]; 
    result
  end
.,.,

module_eval(<<'.,.,', 'drbd.rb.yy', 118)
  def _reduce_86(val, _values, result)
     return ["#{val[0]}", val[1]]; 
    result
  end
.,.,

module_eval(<<'.,.,', 'drbd.rb.yy', 119)
  def _reduce_87(val, _values, result)
     return ["#{val[0]}", val[1]]; 
    result
  end
.,.,

module_eval(<<'.,.,', 'drbd.rb.yy', 120)
  def _reduce_88(val, _values, result)
     return ["#{val[0]}", val[1]]; 
    result
  end
.,.,

module_eval(<<'.,.,', 'drbd.rb.yy', 121)
  def _reduce_89(val, _values, result)
     return ["#{val[0]}", val[1]]; 
    result
  end
.,.,

module_eval(<<'.,.,', 'drbd.rb.yy', 122)
  def _reduce_90(val, _values, result)
     return ["#{val[0]}", val[1]]; 
    result
  end
.,.,

module_eval(<<'.,.,', 'drbd.rb.yy', 123)
  def _reduce_91(val, _values, result)
     return ["#{val[0]}", val[1]]; 
    result
  end
.,.,

module_eval(<<'.,.,', 'drbd.rb.yy', 125)
  def _reduce_92(val, _values, result)
     return "#{val[0]}:#{val[2]}"; 
    result
  end
.,.,

module_eval(<<'.,.,', 'drbd.rb.yy', 126)
  def _reduce_93(val, _values, result)
     return "#{val[0]} #{val[1]}:#{val[3]}"; 
    result
  end
.,.,

module_eval(<<'.,.,', 'drbd.rb.yy', 127)
  def _reduce_94(val, _values, result)
     return "#{val[0]} #{val[1]}:#{val[3]}"; 
    result
  end
.,.,

module_eval(<<'.,.,', 'drbd.rb.yy', 129)
  def _reduce_95(val, _values, result)
     return "#{val[0]} #{val[1]}"; 
    result
  end
.,.,

module_eval(<<'.,.,', 'drbd.rb.yy', 130)
  def _reduce_96(val, _values, result)
     return val[0]; 
    result
  end
.,.,

module_eval(<<'.,.,', 'drbd.rb.yy', 132)
  def _reduce_97(val, _values, result)
     return val[0]; 
    result
  end
.,.,

module_eval(<<'.,.,', 'drbd.rb.yy', 134)
  def _reduce_98(val, _values, result)
     return {}; 
    result
  end
.,.,

module_eval(<<'.,.,', 'drbd.rb.yy', 135)
  def _reduce_99(val, _values, result)
     nk = val[1][0]; val[0][nk] = val[1][1]; return val[0]; 
    result
  end
.,.,

module_eval(<<'.,.,', 'drbd.rb.yy', 137)
  def _reduce_100(val, _values, result)
     return ["#{val[0]}", val[1]]; 
    result
  end
.,.,

module_eval(<<'.,.,', 'drbd.rb.yy', 138)
  def _reduce_101(val, _values, result)
     return ["#{val[0]}", true]; 
    result
  end
.,.,

module_eval(<<'.,.,', 'drbd.rb.yy', 139)
  def _reduce_102(val, _values, result)
     return ["#{val[0]}", val[1]]; 
    result
  end
.,.,

module_eval(<<'.,.,', 'drbd.rb.yy', 140)
  def _reduce_103(val, _values, result)
     return ["#{val[0]}", val[1]]; 
    result
  end
.,.,

def _reduce_none(val, _values, result)
  val[0]
end

end   # class DrbdParser

dp = DrbdParser.new

$drbdcfg = "/etc/drbd.conf"
$configstr = ""
in_skip = false

if !File.exist?($drbdcfg)
	file = File.open($drbdcfg, "w")
        file.close
end


File.open($drbdcfg, "r") do |file|
   file.each_line do |line| 
      line = line.gsub(/#.*$/, '').chomp
      if (line =~ /^skip\s+/) then in_skip = true end
      if (line =~ /^\}/ && in_skip == true) then 
      	 in_skip = false 
         line = ""
      end
      if (! in_skip ) then
         $configstr += line.gsub(/#.*$/, '').chomp
      end
   end
end

dp.parse($configstr)



$debug = 0
def errlog (str)
    if $debug == 1 then
	$stderr.puts str
    end
end	

def convertYcp (str)
    return str.gsub(/"/, '\"')
end

def doList (path)
  if path.length == 0 then
    puts "[ \"global\", \"resources\", \"common\" ]"
    return
  end

  res = $drbd
  begin
    path.each do |it|
	  errlog it.to_s
	  errlog "xxx"+res.to_s
	  if res.has_key?(it.chomp) then
		res = res[it.chomp]
      else
	    errlog "quit as not key. " + it
        puts "nil"
        return
      end
    end

	errlog "xxx"+res.to_s
	errlog "xxx"+$drbd.to_s

	if res == nil then
		puts "nil"
		return
	end

    if res.length == 0 then
       str = "[]"
    else
       str = "[ "
       res.keys.each do |key|
          str = str + "\"" + convertYcp(key.to_s) + "\", "
       end
       str = str.chop.chop + " ]"
    end
	puts str
    return

  rescue NoMethodError
    errlog "quit as exceptions happends."
    puts "nil"
    return
  end
end

def doRead(path)
  if path.length == 0 then
    puts "nil"
    return
  end

  res = $drbd
  begin
    path.each do |it|
      if res.has_key?(it.chomp) then
        res = res[it.chomp]
      else
        puts "nil"
        return
      end
    end

    puts '"'+convertYcp(res.to_s)+'"'
    return 
  rescue NoMethodError
    puts "nil"
    return
  end

end

def stripQuote(path)
  path.each_index do |it|
    if ! path[it] == "" and path[it][0] == '"' then
	  path[it]=path[it][1..-2]
	end
  end
  return path
end

def doWrite(path, args)
  errlog "write path is "+path.to_s
  errlog "write args is "+args

  if path.length == 0 then
    commitChange()
    puts "nil"
    return
  end

  path.each_index do |it|
    errlog "found "+path[it]
    if path[it] != "" and path[it][0] == 34 then
	  errlog path[it]+" is changed to "+path[it].chomp()[1..-2]
      path[it]=path[it].chomp()[1..-2]
    end
	if path[it] != "" and path[it][0..1] == "\\\"" then
		errlog path[it]+" is changed to "+path[it].chomp()[1..-3]+"\""
		path[it]=path[it].chomp()[1..-3]+"\""
	end
  end

  if args[0..1] == "\\\"" then
    errlog "args is changed to " + args[1..-3] + "\""
	args = args.chomp()[1..-3]+"\""
  end

  errlog path.to_s

  if path.length < 2 then
    puts "nil"
    return
  end

  if path[-2].chomp == "on" then
    errlog "prepare to change the node name"
    res = $drbd
    res_b = res
    begin
      path.each do |it|
        if res.has_key?(it.chomp) then
          res_b = res
          res = res[it.chomp]
        else
		  puts "nil"
		  return
        end
      end

      errlog "found the node name, change it"
	  if args != "nil" then
        res_b.delete(args)
        res_b[args] = res_b[path[-1].chomp]
        res_b.delete(path[-1].chomp)
	  else
	    res_b.delete(path[-1].chomp)
	  end
      writeFile
      puts "nil"
      return
    rescue
      puts "nil"
      return
    end

  elsif path[-2].chomp == "resources" then
    errlog "prepare to change the resource name"
    if $drbd["resources"].has_key?(path[-1].chomp) then
	  if args != "nil" then
        $drbd["resources"].delete(args)
        $drbd["resources"][args] = $drbd["resources"][path[-1].chomp]
        $drbd["resources"].delete(path[-1].chomp)
	  else
	    $drbd["resources"].delete(path[-1].chomp)
      end	  
      writeFile
      puts "nil"
      return
    end

  else
    errlog "prepare to change the attribute"
    res = $drbd
    res_b = res
    begin
      path.each do |it|
        if res.has_key?(it.chomp) then
          res_b = res
          res = res[it.chomp]
        else
		  res[it.chomp] = Hash.new()
		  res_b = res
		  res = res[it.chomp]
        end
      end

      errlog "found the attribute name, change it"
	  if args != "nil" then
        res_b[path[-1].chomp] = args
	  else
        res_b.delete(path[-1].chomp)
      end	
      writeFile
      puts "nil"
      return
    rescue
      puts "nil"
      return
    end
  end
  puts "nil"
end

def writeFile()
  errlog $drbd.to_s	
  errlog "start to writeFile"
  File.open($drbdcfg+".YaST2new", "w") do |file|
    if $drbd.has_key?("global") then
      file.puts "global {"
      $drbd["global"].each_key do |key|
	    if key == "disable-ip-verification" then
		  if $drbd["global"][key] == "" or $drbd["global"][key] == "true" then
		    file.puts "   "+key+";"
		  end
		else
          file.puts "   "+key+"\t"+$drbd["global"][key]+";"
		end
      end
      file.puts "}"
    end

	if $drbd.has_key?("common") then
		file.puts "common {"

        if $drbd["common"].has_key?("disk_s") then
          file.puts "   disk {"
          $drbd["common"]["disk_s"].each_key do |key|
            file.puts "      "+key+"\t"+$drbd["common"]["disk_s"][key]+";"
          end
          file.puts "   }"
        end

        if $drbd["common"].has_key?("syncer") then
          file.puts "   syncer {"
          $drbd["common"]["syncer"].each_key do |key|
            file.puts "      "+key+"\t"+$drbd["common"]["syncer"][key]+";"
          end
          file.puts "   }"
        end

        if $drbd["common"].has_key?("net") then
          file.puts "   net {"
          $drbd["common"]["net"].each_key do |key|
            file.puts "      "+key+"\t"+$drbd["common"]["net"][key]+";"
          end
          file.puts "   }"
        end

        if $drbd["common"].has_key?("startup") then
          file.puts "   startup {"
          $drbd["common"]["startup"].each_key do |key|
            file.puts "      "+key+"\t"+$drbd["common"]["startup"][key]+";"
          end
          file.puts "   }"
        end

        if $drbd["common"].has_key?("handlers") then
          file.puts "   handlers {"
          $drbd["common"]["handlers"].each_key do |key|
            file.puts "      "+key+"\t"+$drbd["common"]["handlers"][key]+";"
          end
          file.puts "   }"
        end

		file.puts "}"
	end

    if $drbd.has_key?("resources") then
      $drbd["resources"].each_key do |res_name|
        file.puts "resource "+res_name+" {"

        if $drbd["resources"][res_name].has_key?("protocol") then
          file.puts "   protocol\t"+$drbd["resources"][res_name]["protocol"]+";"
        end
		if $drbd["resources"][res_name].has_key?("device") then
          file.puts "   device\t"+$drbd["resources"][res_name]["device"]+";"
        end
		if $drbd["resources"][res_name].has_key?("disk") then
          file.puts "   disk\t"+$drbd["resources"][res_name]["disk"]+";"
        end
		if $drbd["resources"][res_name].has_key?("meta-disk") then
          file.puts "   meta-disk\t"+$drbd["resources"][res_name]["meta-disk"]+";"
        end

        if $drbd["resources"][res_name].has_key?("disk_s") then
          file.puts "   disk {"
          $drbd["resources"][res_name]["disk_s"].each_key do |key|
            file.puts "      "+key+"\t"+$drbd["resources"][res_name]["disk_s"][key]+";"
          end
          file.puts "   }"
        end

        if $drbd["resources"][res_name].has_key?("syncer") then
          file.puts "   syncer {"
          $drbd["resources"][res_name]["syncer"].each_key do |key|
            file.puts "      "+key+"\t"+$drbd["resources"][res_name]["syncer"][key]+";"
          end
          file.puts "   }"
        end

        if $drbd["resources"][res_name].has_key?("net") then
          file.puts "   net {"
          $drbd["resources"][res_name]["net"].each_key do |key|
            file.puts "      "+key+"\t"+$drbd["resources"][res_name]["net"][key]+";"
          end
          file.puts "   }"
        end

        if $drbd["resources"][res_name].has_key?("startup") then
          file.puts "   startup {"
          $drbd["resources"][res_name]["startup"].each_key do |key|
            file.puts "      "+key+"\t"+$drbd["resources"][res_name]["startup"][key]+";"
          end
          file.puts "   }"
        end

        if $drbd["resources"][res_name].has_key?("handlers") then
          file.puts "   handlers {"
          $drbd["resources"][res_name]["handlers"].each_key do |key|
            file.puts "      "+key+"\t"+$drbd["resources"][res_name]["handlers"][key]+";"
          end
          file.puts "   }"
        end

        if $drbd["resources"][res_name].has_key?("on") then
          $drbd["resources"][res_name]["on"].each_key do |node_name|
            file.puts "   on "+node_name+" {"
            $drbd["resources"][res_name]["on"][node_name].each_key do |key|
              file.puts "      "+key+"\t"+$drbd["resources"][res_name]["on"][node_name][key]+";"
            end
            file.puts "   }"
          end
        end

        file.puts "}"
      end
    end
  end
end

def commitChange()
  if not File.exist?($drbdcfg+".YaST2new") then
    return
  elsif File.exist?($drbdcfg) then
    File.rename($drbdcfg, $drbdcfg+".YaST2save")
  end
  File.rename($drbdcfg+".YaST2new", $drbdcfg)
end

# `Write (.drbd) means to write the file, other wise, the file is not written anyway

errlog($drbd.to_s)

$stdin.each do |line|
  errlog(line)
  line.chomp
  cmd = line.gsub(/^`?([a-zA-Z]+)\s+$/, '\1')
  path = line.gsub(/^`?([a-zA-Z]+)\s+\(([^,]*)(,.*)?\)$/, '\2').split('.')-[""]-["\n"]
  args = line.gsub(/^`?([a-zA-Z]+)\s+\(([^,]*)(,.*)?\)$/, '\3')
  if args.length != 0 then
    args[0] = ' '
    args = args.lstrip().rstrip()
    if args[0] == 34 then
      args = args[1..-2]
    end
  end
  case cmd
    when /Dir/
      doList(path)
    when /Read/
      doRead(path)
	when /Write/
	  doWrite(path, args)
	when /result/
	  exit
    when /.*/
      puts "nil"
  end
  $stdout.flush
end
