{"thread":{"id":"35787","subject":"Re: [PATCH v2] userdiff: update Ada patterns","startedAt":"2014-02-03T18:33:01Z","lastAt":"2014-02-03T20:05:49Z","messageCount":2,"participants":["George Spelvin","Junio C Hamano"],"isPatch":true,"patchVersion":2,"patchTotal":null},"messages":[{"id":"234122","messageId":"20140203183301.3642.qmail@science.horizon.com","threadId":"35787","inReplyTo":null,"subject":"Re: [PATCH v2] userdiff: update Ada patterns","fromName":"George Spelvin","fromEmail":"linux@horizon.com","sentAt":"2014-02-03T18:33:01Z","receivedAt":"2014-02-03T18:33:01Z","isPatch":true,"sender":{"key":"linux@horizon.com","avatar":null},"body":"Looking at the grammar at http://www.adahome.com/rm95/rm9x-P.html\nand http://www.adaic.org/resources/add_content/standards/05rm/html/RM-2-4.html\nI see the following restrictions apply:\n\n- A number must begin and end with a digit.  There must be at least one\n  digit on either side of each underscore and decimal point.\n- There may be at most one decimal point in a number.\n- The base must be between 2 and 16, inclusive.\n\n[-+]?(\n        [0-9](_?[0-9])*([.][0-9](_?[0-9])*)?|\n        ([2-9]|1[0-6])#[0-9a-fA-F](_?[0-9a-fA-F])*([.][0-9a-fA-F](_?[0-9a-fA-F])*)?#\n)([eE][+-]?[0-9](_?[0-9])*)?\n\nIf you want a slightly smaller version, we can drop the \"only one decimal\npoint\" rule and get\n\n[-+]?(\n        [0-9]([._]?[0-9])*|\n        ([2-9]|1[0-6])#[0-9a-fA-F]([._]?[0-9a-fA-F])*#\n)([eE][+-]?[0-9](_?[0-9])*)?\n\nIdeally, for a based number, the range of acceptable digits would\ndepend on the base.  Which is possible for a finite-state machine since\nthe number of bases is finite, but laeds to a bit of a state explosion.\nHere's an approximation that separates bases 2-9 and 10-16:\n\n[-+]?(\n        [0-9](_?[0-9])*([.][0-9](_?[0-9])*)?|\n        [2-9]#[0-8](_?[0-8])*([.][0-8](_?[0-8])*)?#|\n        1[0-6]#[0-9a-fA-F](_?[0-9a-fA-F])*([.][0-9a-fA-F](_?[0-9a-fA-F])*)?#\n)([eE][+-]?[0-9](_?[0-9])*)?\n\nbecause I think that this is overdoing it:\n\n[-+]?(\n        [0-9](_?[0-9])*([.][0-9](_?[0-9])*)?|\n        2#[0-1](_?[0-1])*([.][0-1](_?[0-1])*)?#|\n        3#[0-2](_?[0-2])*([.][0-2](_?[0-2])*)?#|\n        4#[0-3](_?[0-3])*([.][0-3](_?[0-3])*)?#|\n        5#[0-4](_?[0-4])*([.][0-4](_?[0-4])*)?#|\n        6#[0-5](_?[0-5])*([.][0-5](_?[0-5])*)?#|\n        7#[0-5](_?[0-5])*([.][0-5](_?[0-5])*)?#|\n        8#[0-7](_?[0-7])*([.][0-7](_?[0-7])*)?#|\n        9#[0-8](_?[0-8])*([.][0-8](_?[0-8])*)?#|\n        10#[0-9](_?[0-9])*([.][0-9](_?[0-9])*)?#|\n        11#[0-9aA](_?[0-9aA])*([.][0-9aA](_?[0-9aA])*)?#|\n        12#[0-9abAB](_?[0-9abAB])*([.][0-9abAB](_?[0-9abAB])*)?#|\n        13#[0-9a-cA-C](_?[0-9a-cA-C])*([.][0-9a-cA-C](_?[0-9a-cA-C])*)?#|\n        14#[0-9a-dA-D](_?[0-9a-dA-D])*([.][0-9a-dA-D](_?[0-9a-dA-D])*)?#|\n        15#[0-9a-eA-E](_?[0-9a-eA-E])*([.][0-9a-eA-E](_?[0-9a-eA-E])*)?#|\n        16#[0-9a-fA-F](_?[0-9a-fA-F])*([.][0-9a-fA-F](_?[0-9a-fA-F])*)?#|\n)([eE][+-]?[0-9](_?[0-9])*)?\n\nAnother point is that Ada doesn't actually include leading + or -\nsigns in the syntax for \"number\", but rather makes them unary operators.\nThis means that spaces are allowed, and whether you want to include them\nin the \"number\" pattern is a judgement call.\n"},{"id":"234145","messageId":"xmqqlhxsdkrm.fsf@gitster.dls.corp.google.com","threadId":"35787","inReplyTo":"20140203183301.3642.qmail@science.horizon.com","subject":"Re: [PATCH v2] userdiff: update Ada patterns","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2014-02-03T20:05:49Z","receivedAt":"2014-02-03T20:05:49Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"George Spelvin\" <linux@horizon.com> writes:\n\n> Another point is that Ada doesn't actually include leading + or -\n> signs in the syntax for \"number\", but rather makes them unary operators.\n> This means that spaces are allowed, and whether you want to include them\n> in the \"number\" pattern is a judgement call.\n\nI tend to agree.  What do the patterns for other languages do?\n"}]}